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.
102 103 104 105 106 |
# File 'lib/lolbase/data/stats.rb', line 102 def initialize(data) @data = data parse data self end |
Instance Attribute Details
#last_modified ⇒ Object (readonly)
Returns the value of attribute last_modified.
91 92 93 |
# File 'lib/lolbase/data/stats.rb', line 91 def last_modified @last_modified end |
#overall ⇒ Object (readonly)
Returns the value of attribute overall.
91 92 93 |
# File 'lib/lolbase/data/stats.rb', line 91 def overall @overall end |
Instance Method Details
#all ⇒ Object
120 121 122 |
# File 'lib/lolbase/data/stats.rb', line 120 def all return @parsed_data end |
#find(criteria = {}) ⇒ Object
112 113 114 115 116 117 118 |
# File 'lib/lolbase/data/stats.rb', line 112 def find(criteria = {}) raise InvalidArgumentError if criteria.class != Hash if criteria[:champion_id] return @parsed_data.select { |item| item.id == criteria[:champion_id] }.first end nil end |
#raw_json ⇒ Object
108 109 110 |
# File 'lib/lolbase/data/stats.rb', line 108 def raw_json @data end |