Skip to content

Instantly share code, notes, and snippets.

@zeroeth
Created March 23, 2014 20:57
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 zeroeth/9729693 to your computer and use it in GitHub Desktop.
Save zeroeth/9729693 to your computer and use it in GitHub Desktop.
mooncake fun
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