Created
December 19, 2012 09:57
-
-
Save tjackiw/4335648 to your computer and use it in GitHub Desktop.
Design Patterns: Observer Pattern in Ruby
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
car = Car.new(2300) | |
car.log(100) | |
=> "The car has logged 100 miles, totaling 2400 miles traveled." | |
car.log(354) | |
=> "The car has logged 354 miles, totaling 2754 miles traveled." | |
car.log(300) | |
=> "The car has logged 300 miles, totaling 3054 miles traveled." | |
=> "The car needs to be taken in for service!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment