Class: LoLBase::RankedStats
- Inherits:
-
Object
- Object
- LoLBase::RankedStats
- Defined in:
- lib/lolbase/data/stats.rb
Defined Under Namespace
Classes: Champion
Instance Attribute Summary collapse
-
#last_modified ⇒ Object
readonly
Returns the value of attribute last_modified.
-
#overall ⇒ Object
readonly
Returns the value of attribute overall.
Instance Method Summary collapse
- #all ⇒ Object
- #find(criteria = {}) ⇒ Object
-
#initialize(data) ⇒ RankedStats
constructor
A new instance of RankedStats.
- #raw_json ⇒ Object
Constructor Details
#initialize(data) ⇒ RankedStats
Returns a new instance of RankedStats.
95 96 97 98 99 |
# File 'lib/lolbase/data/stats.rb', line 95 def initialize(data) @data = data parse data self end |
Instance Attribute Details
#last_modified ⇒ Object (readonly)
Returns the value of attribute last_modified.
84 85 86 |
# File 'lib/lolbase/data/stats.rb', line 84 def last_modified @last_modified end |
#overall ⇒ Object (readonly)
Returns the value of attribute overall.
84 85 86 |
# File 'lib/lolbase/data/stats.rb', line 84 def overall @overall end |
Instance Method Details
#all ⇒ Object
113 114 115 |
# File 'lib/lolbase/data/stats.rb', line 113 def all return @parsed_data end |
#find(criteria = {}) ⇒ Object
105 106 107 108 109 110 111 |
# File 'lib/lolbase/data/stats.rb', line 105 def find(criteria = {}) if criteria[:champion_id].nil? @parsed_data else @parsed_data.select { |item| item.id == criteria[:champion_id] }.first end end |
#raw_json ⇒ Object
101 102 103 |
# File 'lib/lolbase/data/stats.rb', line 101 def raw_json @data end |