Class: Navigable::CommandBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/navigable/command_builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#inputObject (readonly)

Returns the value of attribute input.



8
9
10
# File 'lib/navigable/command_builder.rb', line 8

def input
  @input
end

#keyObject (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

#executeObject



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

#observersObject



24
25
26
# File 'lib/navigable/command_builder.rb', line 24

def observers
  @observers ||= registered_observers
end