Module: ViewModel::Callbacks::CallbackEnvContext

Defined in:
lib/view_model/callbacks.rb

Overview

Callbacks are run in the instance context of an Env class that wraps the callbacks instance with additional instance method access to the view, context and extra context-dependent parameters.

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/view_model/callbacks.rb', line 14

def method_missing(method, ...)
  if _callbacks.respond_to?(method, true)
    _callbacks.send(method, ...)
  else
    super
  end
end

Instance Method Details

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

Returns:

  • (Boolean)


22
23
24
# File 'lib/view_model/callbacks.rb', line 22

def respond_to_missing?(method, include_all = false)
  _callbacks.respond_to?(method, false) || super
end