Class: Navigable::CommandBuilder
- Inherits:
-
Object
- Object
- Navigable::CommandBuilder
- Defined in:
- lib/navigable/command_builder.rb
Instance Attribute Summary collapse
-
#input ⇒ Object
readonly
Returns the value of attribute input.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(key, input:) ⇒ CommandBuilder
constructor
A new instance of CommandBuilder.
- #observed_by(observer) ⇒ Object
- #observers ⇒ Object
Constructor Details
#initialize(key, input:) ⇒ CommandBuilder
Returns a new instance of CommandBuilder.
10 11 12 13 |
# File 'lib/navigable/command_builder.rb', line 10 def initialize(key, input:) @key = key @input = input end |
Instance Attribute Details
#input ⇒ Object (readonly)
Returns the value of attribute input.
8 9 10 |
# File 'lib/navigable/command_builder.rb', line 8 def input @input end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
8 9 10 |
# File 'lib/navigable/command_builder.rb', line 8 def key @key end |
Instance Method Details
#execute ⇒ Object
20 21 22 |
# File 'lib/navigable/command_builder.rb', line 20 def execute command.execute end |
#observed_by(observer) ⇒ Object
15 16 17 18 |
# File 'lib/navigable/command_builder.rb', line 15 def observed_by(observer) observers << observer self end |
#observers ⇒ Object
24 25 26 |
# File 'lib/navigable/command_builder.rb', line 24 def observers @observers ||= registered_observers end |