Class: Wowr::Classes::ItemCost
- Inherits:
-
Object
- Object
- Wowr::Classes::ItemCost
- Defined in:
- lib/wowr/item.rb
Overview
Cost can be gold or a set of required tokens See ItemCostToken <cost sellPrice=“280” buyPrice=“5600”></cost> <cost> <token icon=“spell_holy_championsbond” id=“29434” count=“60”></token> </cost>
Instance Attribute Summary collapse
-
#buy_price ⇒ Object
readonly
Returns the value of attribute buy_price.
-
#sell_price ⇒ Object
readonly
Returns the value of attribute sell_price.
-
#tokens ⇒ Object
readonly
Returns the value of attribute tokens.
Instance Method Summary collapse
-
#initialize(elem) ⇒ ItemCost
constructor
A new instance of ItemCost.
Constructor Details
#initialize(elem) ⇒ ItemCost
Returns a new instance of ItemCost.
426 427 428 429 430 431 432 433 434 435 436 |
# File 'lib/wowr/item.rb', line 426 def initialize(elem) @buy_price = Money.new(elem[:buyPrice].to_i) if elem[:buyPrice] @sell_price = Money.new(elem[:sellPrice].to_i) if elem[:sellPrice] if (elem%'token') @tokens = [] (elem/:token).each do |token| @tokens << ItemCostToken.new(token) end end end |
Instance Attribute Details
#buy_price ⇒ Object (readonly)
Returns the value of attribute buy_price.
424 425 426 |
# File 'lib/wowr/item.rb', line 424 def buy_price @buy_price end |
#sell_price ⇒ Object (readonly)
Returns the value of attribute sell_price.
424 425 426 |
# File 'lib/wowr/item.rb', line 424 def sell_price @sell_price end |
#tokens ⇒ Object (readonly)
Returns the value of attribute tokens.
424 425 426 |
# File 'lib/wowr/item.rb', line 424 def tokens @tokens end |