Class: UPnP::SSDP::Search
- Inherits:
-
Advertisement
- Object
- Advertisement
- UPnP::SSDP::Search
- Defined in:
- lib/UPnP/SSDP.rb
Overview
Holds information about an M-SEARCH
Instance Attribute Summary collapse
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
-
#wait_time ⇒ Object
readonly
Returns the value of attribute wait_time.
Class Method Summary collapse
-
.parse(response) ⇒ Object
Creates a new Search by parsing the text in
response
.
Instance Method Summary collapse
-
#expiration ⇒ Object
Expiration time of this advertisement.
-
#initialize(date, target, wait_time) ⇒ Search
constructor
Creates a new Search.
-
#inspect ⇒ Object
A friendlier inspect.
Methods inherited from Advertisement
Constructor Details
#initialize(date, target, wait_time) ⇒ Search
Creates a new Search
300 301 302 303 304 |
# File 'lib/UPnP/SSDP.rb', line 300 def initialize(date, target, wait_time) @date = date @target = target @wait_time = wait_time end |
Instance Attribute Details
#date ⇒ Object (readonly)
Returns the value of attribute date.
278 279 280 |
# File 'lib/UPnP/SSDP.rb', line 278 def date @date end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
280 281 282 |
# File 'lib/UPnP/SSDP.rb', line 280 def target @target end |
#wait_time ⇒ Object (readonly)
Returns the value of attribute wait_time.
282 283 284 |
# File 'lib/UPnP/SSDP.rb', line 282 def wait_time @wait_time end |
Class Method Details
.parse(response) ⇒ Object
Creates a new Search by parsing the text in response
287 288 289 290 291 292 293 294 295 |
# File 'lib/UPnP/SSDP.rb', line 287 def self.parse(response) response =~ /^mx:\s*(\d+)/i wait_time = Integer $1 response =~ /^st:\s*(\S*)/i target = $1.strip new Time.now, target, wait_time end |
Instance Method Details
#expiration ⇒ Object
Expiration time of this advertisement
309 310 311 |
# File 'lib/UPnP/SSDP.rb', line 309 def expiration date + wait_time end |
#inspect ⇒ Object
A friendlier inspect
316 317 318 |
# File 'lib/UPnP/SSDP.rb', line 316 def inspect "#<#{self.class}:0x#{object_id.to_s 16} #{target}>" end |