ruby monstas
play

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) =>


  1. Ruby Monstas Session 12

  2. Agenda ● Recap / Questions ● The Ruby Standard Library ● Exercises

  3. Recap

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

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

  6. The Ruby Standard Library

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

  8. The Ruby Standard Library ● More complex features than Ruby Core ● “Batteries included” ● A bit dated, but very solid

  9. Network libraries ● Socket (TCP, UDP) ● Web ● E-Mail

  10. Advanced math libraries ● Prime number generator ● Matrices ● Complex numbers

  11. Data format libraries ● JSON ● XML ● YAML ● RSS

  12. Many more ● Date/Time ● Simple databases ● Cryptography ● Advanced data structures ● Debugging, Profiling, Introspection ● Advanced OO features

  13. Resources Ruby Core documentation: http://ruby-doc. org/core-2.2.3/ Ruby Standard Library documentation: http://ruby-doc.org/stdlib-2.2.3/

  14. Time to practice Let’s get to it!

Recommend


More recommend