Skip to content

Instantly share code, notes, and snippets.

@copyleftdevsbl
Created September 25, 2012 01:28
Show Gist options
  • Save copyleftdevsbl/3779440 to your computer and use it in GitHub Desktop.
Save copyleftdevsbl/3779440 to your computer and use it in GitHub Desktop.
Ruby: Class Stub
#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