Skip to content

Instantly share code, notes, and snippets.

@RubyBrewsday
Created February 7, 2017 16:17
Show Gist options
  • Save RubyBrewsday/1e71ced4023959ebf14ead5ce5037759 to your computer and use it in GitHub Desktop.
Save RubyBrewsday/1e71ced4023959ebf14ead5ce5037759 to your computer and use it in GitHub Desktop.
Cause we all got it
class Tiger
def initialize
@eyes = Eye.new(2)
end
def eye
@eyes.count > 1 ? 1 : 0
end
end
class Eye
attr_reader :count
def initialize(count)
@count = count
end
end
class Person
def initialize(name)
@name = name
end
def got(attribute, object)
puts "{@name} got #{object.send(attribute)} #{attribute} of the #{object}"
end
end
i = Person.new("me")
i.got("eye", Tiger.new)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment