Class: Everypolitician::Entity

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

Direct Known Subclasses

Country, Legislature

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Entity

Returns a new instance of Entity.



33
34
35
36
37
38
39
# File 'lib/everypolitician.rb', line 33

def initialize(data)
  process_data(data).each do |key, value|
    define_singleton_method(key) do
      value
    end
  end
end

Instance Method Details

#process_data(data) ⇒ Object

Override in subclasses to change structure of data



42
43
44
# File 'lib/everypolitician.rb', line 42

def process_data(data)
  data
end