Created
August 19, 2009 17:04
-
-
Save charly/170462 to your computer and use it in GitHub Desktop.
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
require 'rubygems' | |
require 'mixology' | |
module Creme | |
def cost | |
super + 0.4 | |
end | |
end | |
class Coffee | |
def cost | |
3 | |
end | |
end | |
coffee = Coffee.new | |
coffee.mixin Creme | |
coffee.cost # => 3.4 | |
# Waitress, please I asked for a black coffee | |
coffee.unmix Creme | |
coffee.cost # => 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment