Class: Quaff::ToSpec
- Inherits:
-
ABNFSipParser
- Object
- ABNFSipParser
- Quaff::ToSpec
- Defined in:
- lib/sip_parser.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#displayname ⇒ Object
Returns the value of attribute displayname.
-
#is_nameaddr ⇒ Object
Returns the value of attribute is_nameaddr.
-
#params ⇒ Object
Returns the value of attribute params.
-
#uri ⇒ Object
Returns the value of attribute uri.
Instance Method Summary collapse
- #addr_spec ⇒ Object
- #display_name ⇒ Object
-
#initialize ⇒ ToSpec
constructor
A new instance of ToSpec.
- #parse(str) ⇒ Object
- #to_param ⇒ Object
- #to_s ⇒ Object
Methods inherited from ABNFSipParser
#alphanum, #escaped, #from_param, #from_spec, #hostname, #hostport, #laquot, #lws, #mark, #name_addr, #param, #paramchar, #pname, #port, #pvalue, #raquot, #reserved, #sip_uri, #sws, #tel_uri, #to_spec, #unreserved, #uri_parameters, #user, #user_unreserved, #userinfo, #wsp
Constructor Details
#initialize ⇒ ToSpec
Returns a new instance of ToSpec.
254 255 256 257 258 259 260 |
# File 'lib/sip_parser.rb', line 254 def initialize super @params = {} @uri = nil @displayname = nil @is_nameaddr = false end |
Instance Attribute Details
#displayname ⇒ Object
Returns the value of attribute displayname.
253 254 255 |
# File 'lib/sip_parser.rb', line 253 def displayname @displayname end |
#is_nameaddr ⇒ Object
Returns the value of attribute is_nameaddr.
253 254 255 |
# File 'lib/sip_parser.rb', line 253 def is_nameaddr @is_nameaddr end |
#params ⇒ Object
Returns the value of attribute params.
253 254 255 |
# File 'lib/sip_parser.rb', line 253 def params @params end |
#uri ⇒ Object
Returns the value of attribute uri.
253 254 255 |
# File 'lib/sip_parser.rb', line 253 def uri @uri end |
Instance Method Details
#addr_spec ⇒ Object
270 271 272 |
# File 'lib/sip_parser.rb', line 270 def addr_spec super.set_block {|p| @uri = p} end |
#display_name ⇒ Object
266 267 268 |
# File 'lib/sip_parser.rb', line 266 def display_name super.set_block {|p| @displayname = p.strip; @is_nameaddr = true} end |
#parse(str) ⇒ Object
274 275 276 277 278 279 280 |
# File 'lib/sip_parser.rb', line 274 def parse(str) if to_spec.match(Stream.new(str)) true else false end end |
#to_param ⇒ Object
262 263 264 |
# File 'lib/sip_parser.rb', line 262 def to_param super.set_block {|p| k, v = p.split("="); @params[k] = if v.nil? then true else v end} end |
#to_s ⇒ Object
282 283 284 285 286 287 288 289 |
# File 'lib/sip_parser.rb', line 282 def to_s paramstr = Utils.paramhash_to_str(@params) if @is_nameaddr "#{@displayname} <#{@uri}>#{paramstr}" else "#{@uri}#{paramstr}" end end |