Class: Elos::DataObject

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ DataObject

Returns a new instance of DataObject.



4
5
6
7
# File 'lib/elos/data_object.rb', line 4

def initialize(params = {})
  @params = params
  @object = objectify(params)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, **hargs, &block) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/elos/data_object.rb', line 9

def method_missing(method, *args, **hargs, &block)
  if method.to_s.end_with?('=')
    object.send(method, objectify(args[0]))
  elsif object.respond_to?(method)
    object.send(method, *args)
  else
    super
  end
end

Instance Attribute Details

#objectObject (readonly)

Returns the value of attribute object.



2
3
4
# File 'lib/elos/data_object.rb', line 2

def object
  @object
end