Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Seja Feliz com Ruby!

Seja Feliz com Ruby!

Palestra apresentada no 1º encontro ABCoDes no ITESCS - Instituto de Tecnologia de São Caetano do Sul.

lucas renan

August 10, 2013
Tweet

More Decks by lucas renan

Other Decks in Programming

Transcript

  1. nu

  2. class Person attr_accessor :name, :age end person = Person.new person.name

    = "lucas" person.age = 24 puts person.age # => 24
  3. class Person attr_accessor :name, :age def is_adult? @age > 18

    end end person = Person.new person.name = "lucas" person.age = 24 puts person.is_adult? # => true
  4. klass = Class.new do ["say", "scream"].each do |method| define_method method

    do |message| "#{method}ing: #{message}" end end end Person = klass Person.name # => Person person = Person.new puts person.say "ruby" # => saying: ruby puts person.scream "ruby <3" # => screaming: ruby <3