Class: Fancygrid::ObjectWrapper

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

Instance Method Summary collapse

Constructor Details

#initialize(obj) ⇒ ObjectWrapper

Initializes the object wrapper



6
7
8
# File 'lib/fancygrid/object_wrapper.rb', line 6

def initialize obj
  @wrapped = obj
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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

Sends the missing method to the wrapped object and stores the result as the new wrapped object



19
20
21
22
# File 'lib/fancygrid/object_wrapper.rb', line 19

def method_missing(method, *args, &block)
  @wrapped = @wrapped.send(method, *args)
  return self
end

Instance Method Details

#objectObject

Gets the wrapped object



12
13
14
# File 'lib/fancygrid/object_wrapper.rb', line 12

def object
  @wrapped
end