Class: Wowr::Classes::ItemCost
- Inherits:
-
Object
- Object
- Wowr::Classes::ItemCost
- Defined in:
- lib/wowr/classes.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.
1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 |
# File 'lib/wowr/classes.rb', line 1116 def initialize(elem) @buy_price = elem[:buyPrice].to_i if elem[:buyPrice] @sell_price = 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.
1114 1115 1116 |
# File 'lib/wowr/classes.rb', line 1114 def buy_price @buy_price end |
#sell_price ⇒ Object (readonly)
Returns the value of attribute sell_price.
1114 1115 1116 |
# File 'lib/wowr/classes.rb', line 1114 def sell_price @sell_price end |
#tokens ⇒ Object (readonly)
Returns the value of attribute tokens.
1114 1115 1116 |
# File 'lib/wowr/classes.rb', line 1114 def tokens @tokens end |