Class: LoLBase::RankedStats

Inherits:
Object
  • Object
show all
Defined in:
lib/lolbase/data/stats.rb

Defined Under Namespace

Classes: Champion

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ RankedStats

Returns a new instance of RankedStats.



94
95
96
97
98
# File 'lib/lolbase/data/stats.rb', line 94

def initialize(data)
  @data = data
  parse data
  self
end

Instance Attribute Details

#last_modifiedObject (readonly)

Returns the value of attribute last_modified.



83
84
85
# File 'lib/lolbase/data/stats.rb', line 83

def last_modified
  @last_modified
end

#overallObject (readonly)

Returns the value of attribute overall.



83
84
85
# File 'lib/lolbase/data/stats.rb', line 83

def overall
  @overall
end

Instance Method Details

#allObject



111
112
113
# File 'lib/lolbase/data/stats.rb', line 111

def all
  return @parsed_data
end

#find(criteria = {}) ⇒ Object



104
105
106
107
108
109
# File 'lib/lolbase/data/stats.rb', line 104

def find(criteria = {})
  if criteria[:champion_id]
    return @parsed_data.select { |item| item.id == criteria[:champion_id] }.first
  end
  nil
end

#raw_jsonObject



100
101
102
# File 'lib/lolbase/data/stats.rb', line 100

def raw_json
  @data
end