Class: Mockingbird::Commands::Command
- Inherits:
-
Object
- Object
- Mockingbird::Commands::Command
- Defined in:
- lib/mockingbird/commands.rb
Instance Attribute Summary collapse
-
#callback ⇒ Object
Returns the value of attribute callback.
-
#next_command ⇒ Object
Returns the value of attribute next_command.
Instance Method Summary collapse
- #advance(conn) ⇒ Object
-
#initialize(&block) ⇒ Command
constructor
A new instance of Command.
- #run(conn) ⇒ Object
Constructor Details
#initialize(&block) ⇒ Command
Returns a new instance of Command.
7 8 9 |
# File 'lib/mockingbird/commands.rb', line 7 def initialize(&block) self.callback = block end |
Instance Attribute Details
#callback ⇒ Object
Returns the value of attribute callback.
5 6 7 |
# File 'lib/mockingbird/commands.rb', line 5 def callback @callback end |
#next_command ⇒ Object
Returns the value of attribute next_command.
5 6 7 |
# File 'lib/mockingbird/commands.rb', line 5 def next_command @next_command end |
Instance Method Details
#advance(conn) ⇒ Object
16 17 18 |
# File 'lib/mockingbird/commands.rb', line 16 def advance(conn) next_command.run(conn) if next_command end |
#run(conn) ⇒ Object
11 12 13 14 |
# File 'lib/mockingbird/commands.rb', line 11 def run(conn) callback.call(conn) if callback advance(conn) end |