Class: EveApi::Data::Generic

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

Direct Known Subclasses

Result, Row

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Generic

Returns a new instance of Generic.



4
5
6
# File 'lib/eve_api/data.rb', line 4

def initialize(data)
  @data = data
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/eve_api/data.rb', line 8

def method_missing(name, *args)
  if !@data.has_key?(name.to_sym)
    return super
  end
  
  return @data[name.to_sym]
end

Instance Method Details

#inspectObject



20
21
22
# File 'lib/eve_api/data.rb', line 20

def inspect
  "<# EveApi::Data::Generic keys: #{keys} >"
end

#keysObject



16
17
18
# File 'lib/eve_api/data.rb', line 16

def keys
  @data.keys
end

#to_hashObject



24
25
26
# File 'lib/eve_api/data.rb', line 24

def to_hash
  @data.dup
end