Class: PoeWatch::Item
Constant Summary
Constants inherited from Base
Instance Method Summary collapse
- #price_for_league(name_or_regexp) ⇒ Object
- #price_for_leagues(name_or_regexp) ⇒ Object
- #prices ⇒ Object
Methods inherited from Base
__data, __data=, all, count, find, #initialize, type, where
Constructor Details
This class inherits a constructor from PoeWatch::Base
Instance Method Details
#price_for_league(name_or_regexp) ⇒ Object
15 16 17 |
# File 'lib/item.rb', line 15 def price_for_league(name_or_regexp) prices.find { |data| name_or_regexp.is_a?(String) ? data.name.downcase == name_or_regexp.downcase : data.name.match(name_or_regexp) } end |
#price_for_leagues(name_or_regexp) ⇒ Object
10 11 12 13 |
# File 'lib/item.rb', line 10 def price_for_leagues(name_or_regexp) regexp = name_or_regexp.is_a?(String) ? Regexp.new(name_or_regexp, 'i') : name_or_regexp prices.select { |data| data.name.match(regexp) } end |