Class: Ovto::WiredActions
- Inherits:
-
Object
- Object
- Ovto::WiredActions
- Defined in:
- lib/ovto/wired_actions.rb
Instance Method Summary collapse
-
#_app ⇒ Object
internal.
-
#initialize(actions, app, runtime, parent) ⇒ WiredActions
constructor
Create a WiredActions.
- #method_missing(name, args_hash = {}) ⇒ Object
- #respond_to?(name) ⇒ Boolean
Constructor Details
#initialize(actions, app, runtime, parent) ⇒ WiredActions
Create a WiredActions
-
actions: Ovto::Actions
-
app: Ovto::App
-
runtime: Ovto::Runtime (to call scheduleRender after state change)
-
parent: WiredActionSet
12 13 14 |
# File 'lib/ovto/wired_actions.rb', line 12 def initialize(actions, app, runtime, parent) @actions, @app, @runtime, @parent = actions, app, runtime, parent end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, args_hash = {}) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/ovto/wired_actions.rb', line 16 def method_missing(name, args_hash={}) raise NoMethodError, "undefined method `#{name}' on #{self}" unless respond_to?(name) if @actions.respond_to?(name) Ovto.log_error { Ovto.debug_trace_log("invoke action \"#{name}\" on #{@actions.class}") invoke_action(name, args_hash) } else @parent[name][WiredActionSet::THE_MIDDLEWARE_ITSELF] # WiredActions of a middleware named `name` end end |
Instance Method Details
#_app ⇒ Object
internal
33 34 35 |
# File 'lib/ovto/wired_actions.rb', line 33 def _app @app end |
#respond_to?(name) ⇒ Boolean
28 29 30 |
# File 'lib/ovto/wired_actions.rb', line 28 def respond_to?(name) @actions.respond_to?(name) || @parent.middleware_names.include?(name) end |