Module: PresenterObject::Delegation

Included in:
Base, Collection
Defined in:
lib/presenter_object/delegation.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



2
3
4
5
6
7
8
9
10
# File 'lib/presenter_object/delegation.rb', line 2

def method_missing(name, *args, &block)
  if object.respond_to? name, true
    object.send name, *args, &block
  elsif view_context.respond_to? name, true
    view_context.send name, *args, &block
  else
    super
  end
end

Instance Method Details

#respond_to?(name, include_private = true) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
15
16
17
18
# File 'lib/presenter_object/delegation.rb', line 12

def respond_to?(name, include_private = true)
  if object.respond_to?(name, include_private) || view_context.respond_to?(name, include_private)
    true
  else
    super
  end
end