Class: WaitForDigits
Instance Method Summary
collapse
#command, #command_error?, #message, #result, #return_code, #to_s
Constructor Details
#initialize(command, response) ⇒ WaitForDigits
Returns a new instance of WaitForDigits.
42
43
44
|
# File 'lib/ruby-agi/rs/wait_for_digits.rb', line 42
def initialize(command, response)
super(command, response)
end
|
Instance Method Details
#digits ⇒ Object
76
77
78
|
# File 'lib/ruby-agi/rs/wait_for_digits.rb', line 76
def digits
return result
end
|
#error? ⇒ Boolean
80
81
82
|
# File 'lib/ruby-agi/rs/wait_for_digits.rb', line 80
def error?
return ((not timeout?) and command_error?)
end
|
#failure? ⇒ Boolean
50
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/ruby-agi/rs/wait_for_digits.rb', line 50
def failure?
if @is_failure.nil?
if result == '-1'
@is_failure = true
else
@is_failure = false
end
end
return @is_failure
end
|
#response ⇒ Object
84
85
86
|
# File 'lib/ruby-agi/rs/wait_for_digits.rb', line 84
def response
return message
end
|
#success? ⇒ Boolean
46
47
48
|
# File 'lib/ruby-agi/rs/wait_for_digits.rb', line 46
def success?
return ((not failure?) and (not timeout?))
end
|
#timeout? ⇒ Boolean
63
64
65
66
67
68
69
70
71
72
73
74
|
# File 'lib/ruby-agi/rs/wait_for_digits.rb', line 63
def timeout?
if @is_timeout.nil?
rgx = Regexp.new(/\(timeout\)$/)
if rgx.match(response)
@is_timeout = true
else
@is_timeout = false
end
end
return @is_timeout
end
|