Method: Ebisu::Price#initialize
- Defined in:
- lib/ebisu/models/price.rb
#initialize(price) ⇒ Price
Returns a new instance of Price.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/ebisu/models/price.rb', line 13 def initialize(price) case price when Hash @value = Integer(price['__content__']) @currency = price['currency'] when String @value = Integer(price) @currency = 'JPY' when Integer @value = price @currency = 'JPY' else raise "assertion failed. invalid price response value: #{price}" end end |