Class: Flaker::ObjectWrapper

Inherits:
Base
  • Object
show all
Defined in:
lib/flaker/wrapper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#fetch

Constructor Details

#initialize(hash) ⇒ ObjectWrapper

Returns a new instance of ObjectWrapper.



6
7
8
# File 'lib/flaker/wrapper.rb', line 6

def initialize(hash)
  @data = hash
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name) ⇒ Object



10
11
12
# File 'lib/flaker/wrapper.rb', line 10

def method_missing(method_name)
  @data[method_name.to_s] unless @data.class == 'Hash'
end

Instance Attribute Details

#data=(value) ⇒ Object (writeonly)

Sets the attribute data

Parameters:

  • value

    the value to set the attribute data to.



4
5
6
# File 'lib/flaker/wrapper.rb', line 4

def data=(value)
  @data = value
end