Class: XIVLodestone::AttributeList
- Inherits:
-
Object
- Object
- XIVLodestone::AttributeList
- Defined in:
- lib/xiv_lodestone/lodestone_character_attribute.rb
Overview
A Object that represents a set of atrributes from lodestone website. The class parsers a given xpath for attributes and stores them in a Hash. All method names are based of names of attributes from lodestone website
Constant Summary collapse
- @@attribute_hash =
[ "strength", "dexterity", "vitality", "intelligence", "mind", "piety" ]
Instance Method Summary collapse
-
#initialize(attribute_path) ⇒ AttributeList
constructor
A new instance of AttributeList.
-
#method_missing(method) ⇒ Object
Generate methods from each key in the @attribute hash.
-
#to_json ⇒ Object
Converts t.
Constructor Details
#initialize(attribute_path) ⇒ AttributeList
Returns a new instance of AttributeList.
12 13 14 15 |
# File 'lib/xiv_lodestone/lodestone_character_attribute.rb', line 12 def initialize(attribute_path) @attributes = {} parse_attributes(attribute_path) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method) ⇒ Object
Generate methods from each key in the @attribute hash
17 18 19 20 |
# File 'lib/xiv_lodestone/lodestone_character_attribute.rb', line 17 def method_missing(method) return @attributes[method] if @attributes.key?(method) super end |
Instance Method Details
#to_json ⇒ Object
Converts t
22 23 24 |
# File 'lib/xiv_lodestone/lodestone_character_attribute.rb', line 22 def to_json() @attributes.to_json end |