Class: XIVLodestone::DiscipleList

Inherits:
Object
  • Object
show all
Defined in:
lib/xiv_lodestone/lodestone_character_disciple.rb

Overview

A object representation of disciples(classes) The initialiser takes a hash of Disciple, that layout follows { :rogue => [“Rogue”, 1, 0, 300, “http://…”] }

Defined Under Namespace

Classes: Disciple

Instance Method Summary collapse

Constructor Details

#initialize(disciple_path) ⇒ DiscipleList

Returns a new instance of DiscipleList.



16
17
18
19
# File 'lib/xiv_lodestone/lodestone_character_disciple.rb', line 16

def initialize(disciple_path)
  @disciple = {}
  parse_disciple(disciple_path)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method) ⇒ Object

Generates missing methods using @disciple hash keys



25
26
27
28
# File 'lib/xiv_lodestone/lodestone_character_disciple.rb', line 25

def method_missing(method)
  return @disciple[method] if @disciple.key?(method)
  super
end

Instance Method Details

#to_jsonObject

Returns a json repsentation of all disciples



21
22
23
# File 'lib/xiv_lodestone/lodestone_character_disciple.rb', line 21

def to_json()
  @disciple.to_json
end