Skip to content

Instantly share code, notes, and snippets.

@caike
Created May 5, 2015 19:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save caike/bcc4c43b3e6e83957bcf to your computer and use it in GitHub Desktop.
Save caike/bcc4c43b3e6e83957bcf to your computer and use it in GitHub Desktop.
Demo code for Twit.tv
class Person
def initialize(name, location)
@name, @location = name, location
end
def greet
"Hello my name is #{@name} and I'm from #{@location}"
end
end
carlos = Person.new "Carlos", "Rio de Janeiro"
robert = Person.new "Robert", "San Francisco"
class Person
def say_goodbye
"I am going back to #{@location} now"
end
end
#puts carlos.say_goodbye
#puts robert.say_goodbye
class Fixnum
def print_age
2015 - self
end
end
age = 1984.print_age
puts age
# 10.weeks.ago
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment