Class: Smite::RecommendedItems

Inherits:
Object
  • Object
show all
Defined in:
lib/smite/recommended_items.rb

Instance Attribute Summary collapse

Attributes inherited from Object

#data

Instance Method Summary collapse

Methods inherited from Object

#attributes, #method_missing

Constructor Details

#initialize(god_name, data, role) ⇒ RecommendedItems

Returns a new instance of RecommendedItems.



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/smite/recommended_items.rb', line 4

def initialize(god_name, data, role)
  @god_name = god_name
  @role     = role.downcase
  new_data  = {}

  data.each do |rec|
    next unless rec['Role'].downcase == @role

    new_data[rec['Category']] ||= []
    new_data[rec['Category']] << Smite::Game.device(rec['item_id'])
  end
  super(new_data)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Smite::Object

Instance Attribute Details

#god_nameObject (readonly)

Returns the value of attribute god_name.



3
4
5
# File 'lib/smite/recommended_items.rb', line 3

def god_name
  @god_name
end

#roleObject (readonly)

Returns the value of attribute role.



3
4
5
# File 'lib/smite/recommended_items.rb', line 3

def role
  @role
end

Instance Method Details

#inspectObject



18
19
20
# File 'lib/smite/recommended_items.rb', line 18

def inspect
  "#<Smite::RecommendedItems '#{god_name}' Role: '#{role}'>"
end