Class: SipcMessage::Response
- Inherits:
-
Object
- Object
- SipcMessage::Response
show all
- Defined in:
- lib/rfetion/sipc_message.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(sections) ⇒ Response
Returns a new instance of Response.
141
142
143
|
# File 'lib/rfetion/sipc_message.rb', line 141
def initialize(sections)
@sections = sections
end
|
Instance Attribute Details
#sections ⇒ Object
Returns the value of attribute sections.
139
140
141
|
# File 'lib/rfetion/sipc_message.rb', line 139
def sections
@sections
end
|
Instance Method Details
#class ⇒ Object
145
146
147
148
149
150
151
|
# File 'lib/rfetion/sipc_message.rb', line 145
def class
if first_line =~ %r|^SIP-C/4.0 (\d{3})|
RESPONSES[$1.to_i]
else
SipcMessage::OK
end
end
|
#contain?(command) ⇒ Boolean
157
158
159
|
# File 'lib/rfetion/sipc_message.rb', line 157
def contain?(command)
@sections.find {|section| section.split("\r\n").first.index(%r|#{command} |) }
end
|
#first_line ⇒ Object
153
154
155
|
# File 'lib/rfetion/sipc_message.rb', line 153
def first_line
@sections.first.split("\r\n").first
end
|
#to_s ⇒ Object
161
162
163
|
# File 'lib/rfetion/sipc_message.rb', line 161
def to_s
@sections.first.split("\r\n").first
end
|