Created
November 15, 2012 04:42
-
-
Save svs/4076709 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
# let the argument errors come from the typecast. | |
# one should not worry about the class of the object, just its capabilities. | |
def initialize(hash = {}) | |
@name = hash[:name].to_s | |
@price = hash[:price].to_f | |
@quantity = Integer(hash[:quantity] || 1) | |
@list = List.new(hash[:list]) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment