Class: CMUX::ModemCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/cmux/modem_command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#commandObject (readonly)

Returns the value of attribute command.



3
4
5
# File 'lib/cmux/modem_command.rb', line 3

def command
  @command
end

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

#stateObject (readonly)

Returns the value of attribute state.



3
4
5
# File 'lib/cmux/modem_command.rb', line 3

def state
  @state
end

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

#startObject

modemchatter api



16
17
18
# File 'lib/cmux/modem_command.rb', line 16

def start
  @state = :executing
end