Created
March 23, 2014 20:57
-
-
Save zeroeth/9729693 to your computer and use it in GitHub Desktop.
mooncake fun
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 Oven | |
def bake item | |
item.to_cookie | |
end | |
end | |
class PorkMooncake | |
def to_cookie | |
PorkCookie.new | |
end | |
end | |
class PorkCookie | |
def is_delicious? | |
true | |
end | |
end | |
oven = Oven.new | |
result = oven.bake PorkMooncake.new | |
puts result.is_a? PorkMooncake | |
puts result.is_a? PorkCookie | |
puts result.is_delicious? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment