Class: Haipa::Embedded

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/haipa/embedded.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource, data) ⇒ Embedded

Returns a new instance of Embedded.



9
10
11
12
# File 'lib/haipa/embedded.rb', line 9

def initialize(resource, data)
  @data = data
  @resource = resource
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/haipa/embedded.rb', line 14

def method_missing(name, *args, &block)
  name = name.to_s
  if data.has_key?(name)
    from_array(data[name])
  else
    super
  end
end

Instance Attribute Details

#dataObject (readonly) Also known as: to_hash

Returns the value of attribute data.



5
6
7
# File 'lib/haipa/embedded.rb', line 5

def data
  @data
end

#resourceObject (readonly)

Returns the value of attribute resource.



5
6
7
# File 'lib/haipa/embedded.rb', line 5

def resource
  @resource
end