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.



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_modifiedObject (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

#overallObject (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

#allObject



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_jsonObject



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

def raw_json
  @data
end