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.
467 468 469 470 471 472 473 474 475 476 477 |
# File 'lib/wowr/item.rb', line 467 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.
465 466 467 |
# File 'lib/wowr/item.rb', line 465 def buy_price @buy_price end |
#sell_price ⇒ Object (readonly)
Returns the value of attribute sell_price.
465 466 467 |
# File 'lib/wowr/item.rb', line 465 def sell_price @sell_price end |
#tokens ⇒ Object (readonly)
Returns the value of attribute tokens.
465 466 467 |
# File 'lib/wowr/item.rb', line 465 def tokens @tokens end |