Skip to content

Instantly share code, notes, and snippets.

@havenwood
Created September 13, 2011 17:19
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 havenwood/1214388 to your computer and use it in GitHub Desktop.
Save havenwood/1214388 to your computer and use it in GitHub Desktop.
dog years
class Dog
attr_accessor :age
def dog_years
return "Gimme a human age first, damnit..." unless @age
@dog_years = 15
@dog_years += 9 if @age > 1
@dog_years += (@age - 2) * 4 if @age > 2
@dog_years
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment