Created
September 25, 2012 01:28
-
-
Save copyleftdevsbl/3779440 to your computer and use it in GitHub Desktop.
Ruby: Class Stub
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
#added file to gist to test sublime blug in | |
class Person | |
attr_accessor :name, :age, :job | |
attr_writer :weight | |
def greet | |
"#{@name} says \"Hello\"" | |
end | |
def work | |
"I'm doing my job; I do #{@job}for a living" | |
end | |
def weight | |
@weight - 20 | |
end | |
def talk_to(person) | |
if (person.class == Person) | |
"#{@name} is talking to #{person.name}" | |
else | |
"#{@name} can't talk to it; it isn't a person" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment