Created
October 1, 2008 18:05
-
-
Save trek/14145 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Economy | |
| def slowing? | |
| self.value.today < self.value.yesterday | |
| end | |
| def slow_by(amount) | |
| self.value -= amount | |
| end | |
| end | |
| class Money | |
| def self.print(amount = 10000) | |
| 0.upto(size) do | |
| self.economy << Money.new | |
| end | |
| self.economy.slow_by(amount) | |
| end | |
| end | |
| economy = Economy.new('United States', 'United States Dollars') | |
| while(economy.slowing?) | |
| Money.print | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment