Class: Rooibos::Message::Routed
- Inherits:
-
Data
- Object
- Data
- Rooibos::Message::Routed
- Includes:
- Predicates
- Defined in:
- lib/rooibos/message/routed.rb
Overview
Message synthesized by Router when keymap uses symbol + route.
When a keymap entry uses a symbol instead of a handler, and specifies a route, the Router creates this message and dispatches it to the child fragment’s UPDATE.
Example
# In parent keymap:
key :down, :move_down, route: :file_list
# Router synthesizes:
Routed.new(envelope: :move_down, event: key_event)
# Child UPDATE matches:
in { type: :routed, envelope: :move_down }
handle_move_down(model)
Instance Attribute Summary collapse
-
#envelope ⇒ Object
readonly
Returns the value of attribute envelope.
-
#event ⇒ Object
readonly
Returns the value of attribute event.
Instance Method Summary collapse
- #deconstruct_keys(_keys) ⇒ Object
- #method_missing(method_name, *args, &block) ⇒ Object
- #respond_to_missing?(method_name, include_private = false) ⇒ Boolean
- #routed? ⇒ Boolean
Methods included from Predicates
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/rooibos/message/routed.rb', line 42 def method_missing(method_name, *args, &block) if method_name.end_with?("?") method_name.to_s.chomp("?") == envelope.to_s else super end end |
Instance Attribute Details
#envelope ⇒ Object (readonly)
Returns the value of attribute envelope
27 28 29 |
# File 'lib/rooibos/message/routed.rb', line 27 def envelope @envelope end |
#event ⇒ Object (readonly)
Returns the value of attribute event
27 28 29 |
# File 'lib/rooibos/message/routed.rb', line 27 def event @event end |
Instance Method Details
#deconstruct_keys(_keys) ⇒ Object
30 31 32 |
# File 'lib/rooibos/message/routed.rb', line 30 def deconstruct_keys(_keys) { type: :routed, envelope:, event: } end |
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
38 39 40 |
# File 'lib/rooibos/message/routed.rb', line 38 def respond_to_missing?(method_name, include_private = false) method_name.end_with?("?") || super end |
#routed? ⇒ Boolean
34 35 36 |
# File 'lib/rooibos/message/routed.rb', line 34 def routed? true end |