Module: Pres::ViewDelegation

Included in:
Presenter
Defined in:
lib/pres/view_delegation.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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

Send missing methods to view_context first



10
11
12
13
14
15
16
# File 'lib/pres/view_delegation.rb', line 10

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

Instance Method Details

#respond_to_missing?(method, _ = false) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/pres/view_delegation.rb', line 18

def respond_to_missing?(method, _ = false)
  view_context.respond_to?(method, true) || super
end

#view_contextObject



5
6
7
# File 'lib/pres/view_delegation.rb', line 5

def view_context
  @view_context
end