Class: Aggro::Channel
- Inherits:
-
Struct
- Object
- Struct
- Aggro::Channel
- Defined in:
- lib/aggro/channel.rb
Overview
Private: Provides an interface to communicate with an aggregate or saga.
Only loads the target object when needed.
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #forward_command(command) ⇒ Object
- #handles_command?(command) ⇒ Boolean
- #handles_query?(query) ⇒ Boolean
- #run_query(query) ⇒ Object
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id
4 5 6 |
# File 'lib/aggro/channel.rb', line 4 def id @id end |
#type ⇒ Object
Returns the value of attribute type
4 5 6 |
# File 'lib/aggro/channel.rb', line 4 def type @type end |
Instance Method Details
#forward_command(command) ⇒ Object
5 6 7 |
# File 'lib/aggro/channel.rb', line 5 def forward_command(command) target << command if handles_command?(command) end |
#handles_command?(command) ⇒ Boolean
9 10 11 |
# File 'lib/aggro/channel.rb', line 9 def handles_command?(command) target_class.allows? command end |
#handles_query?(query) ⇒ Boolean
13 14 15 |
# File 'lib/aggro/channel.rb', line 13 def handles_query?(query) target_class.responds_to? query end |
#run_query(query) ⇒ Object
17 18 19 |
# File 'lib/aggro/channel.rb', line 17 def run_query(query) target.ask query if handles_query? query end |