Ruby Monstas Session 12 Agenda Recap / Questions The Ruby - - PowerPoint PPT Presentation

ruby monstas
SMART_READER_LITE
LIVE PREVIEW

Ruby Monstas Session 12 Agenda Recap / Questions The Ruby - - PowerPoint PPT Presentation

Ruby Monstas Session 12 Agenda Recap / Questions The Ruby Standard Library Exercises Recap Example: Class Person class Person irb> lucy = Person.new("Lucy", 1984) def initialize(name, year_born) =>


slide-1
SLIDE 1

Ruby Monstas

Session 12

slide-2
SLIDE 2

Agenda

  • Recap / Questions
  • The Ruby Standard Library
  • Exercises
slide-3
SLIDE 3

Recap

slide-4
SLIDE 4

Example: Class Person

class Person def initialize(name, year_born) @name = name @year_born = year_born end def name @name end def age CURRENT_YEAR - @year_born end end irb> lucy = Person.new("Lucy", 1984) => #<Person:0x007f8b8289a868> irb> lucy.name => "Lucy" irb> lucy.age => 31

slide-5
SLIDE 5

Example: Class Person

class Person def initialize(name, year_born) @name = name @year_born = year_born end def name @name end def age CURRENT_YEAR - @year_born end end irb> lucy = Person.new("Lucy", 1984) Class Object Constructor Instance Method Instance Variable

slide-6
SLIDE 6

The Ruby Standard Library

slide-7
SLIDE 7

Ruby Distribution

The Ruby Distribution

Ruby Language (Syntax) Ruby Core (Strings, Symbols, Arrays, Hashes …) Ruby Standard Library (More advanced Classes/Features)

slide-8
SLIDE 8

The Ruby Standard Library

  • More complex features than Ruby Core
  • “Batteries included”
  • A bit dated, but very solid
slide-9
SLIDE 9

Network libraries

  • Socket (TCP, UDP)
  • Web
  • E-Mail
slide-10
SLIDE 10

Advanced math libraries

  • Prime number generator
  • Matrices
  • Complex numbers
slide-11
SLIDE 11

Data format libraries

  • JSON
  • XML
  • YAML
  • RSS
slide-12
SLIDE 12

Many more

  • Date/Time
  • Simple databases
  • Cryptography
  • Advanced data structures
  • Debugging, Profiling, Introspection
  • Advanced OO features
slide-13
SLIDE 13

Resources

Ruby Core documentation: http://ruby-doc.

  • rg/core-2.2.3/

Ruby Standard Library documentation: http://ruby-doc.org/stdlib-2.2.3/

slide-14
SLIDE 14

Time to practice

Let’s get to it!