Created
May 5, 2015 19:25
-
-
Save caike/bcc4c43b3e6e83957bcf to your computer and use it in GitHub Desktop.
Demo code for Twit.tv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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