Class: Spielbash::CommandAction
- Inherits:
-
BaseAction
- Object
- BaseAction
- Spielbash::CommandAction
- Defined in:
- lib/spielbash/model/action/command_action.rb
Instance Attribute Summary collapse
-
#command ⇒ Object
Returns the value of attribute command.
Attributes inherited from BaseAction
Instance Method Summary collapse
- #execute(session) ⇒ Object
-
#initialize(command, action_context) ⇒ CommandAction
constructor
A new instance of CommandAction.
Constructor Details
#initialize(command, action_context) ⇒ CommandAction
Returns a new instance of CommandAction.
5 6 7 8 |
# File 'lib/spielbash/model/action/command_action.rb', line 5 def initialize(command, action_context) super(action_context) @command = command end |
Instance Attribute Details
#command ⇒ Object
Returns the value of attribute command.
3 4 5 |
# File 'lib/spielbash/model/action/command_action.rb', line 3 def command @command end |
Instance Method Details
#execute(session) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/spielbash/model/action/command_action.rb', line 10 def execute(session) command.each_char do |c| session.send_key(c) sleep(action_context.typing_delay_s) end session.send_key('C-m') session.wait if action_context.wait sleep(action_context.reading_delay_s) end |