Class: CMUX::ModemCommand
- Inherits:
-
Object
- Object
- CMUX::ModemCommand
- Defined in:
- lib/cmux/modem_command.rb
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#issued_at ⇒ Object
readonly
Returns the value of attribute issued_at.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#timeout ⇒ Object
readonly
Returns the value of attribute timeout.
Instance Method Summary collapse
- #complete(response) ⇒ Object
-
#initialize(command, chatter, timeout, &block) ⇒ ModemCommand
constructor
A new instance of ModemCommand.
-
#start ⇒ Object
modemchatter api.
Constructor Details
#initialize(command, chatter, timeout, &block) ⇒ ModemCommand
Returns a new instance of ModemCommand.
5 6 7 8 9 10 11 12 |
# File 'lib/cmux/modem_command.rb', line 5 def initialize(command, chatter, timeout, &block) @command = command @chatter = chatter @timeout = timeout @issued_at = DateTime.now.to_time @block = block @state = :queued end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
3 4 5 |
# File 'lib/cmux/modem_command.rb', line 3 def command @command end |
#issued_at ⇒ Object (readonly)
Returns the value of attribute issued_at.
3 4 5 |
# File 'lib/cmux/modem_command.rb', line 3 def issued_at @issued_at end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
3 4 5 |
# File 'lib/cmux/modem_command.rb', line 3 def state @state end |
#timeout ⇒ Object (readonly)
Returns the value of attribute timeout.
3 4 5 |
# File 'lib/cmux/modem_command.rb', line 3 def timeout @timeout end |
Instance Method Details
#complete(response) ⇒ Object
20 21 22 23 24 |
# File 'lib/cmux/modem_command.rb', line 20 def complete(response) @state = :complete @block.call response unless @block.nil? end |
#start ⇒ Object
modemchatter api
16 17 18 |
# File 'lib/cmux/modem_command.rb', line 16 def start @state = :executing end |