class UPnP::SSDP::Search

Holds information about an M-SEARCH

Attributes

date[R]
target[R]
wait_time[R]

Public Class Methods

new(date, target, wait_time) click to toggle source

Creates a new Search

# File lib/UPnP/SSDP.rb, line 300
def initialize(date, target, wait_time)
  @date = date
  @target = target
  @wait_time = wait_time
end
parse(response) click to toggle source

Creates a new Search by parsing the text in response

# File lib/UPnP/SSDP.rb, line 287
def self.parse(response)
  response =~ %r^mx:\s*(\d+)/
  wait_time = Integer $1

  response =~ %r^st:\s*(\S*)/
  target = $1.strip

  new Time.now, target, wait_time
end

Public Instance Methods

expiration() click to toggle source

Expiration time of this advertisement

# File lib/UPnP/SSDP.rb, line 309
def expiration
  date + wait_time
end
inspect() click to toggle source

A friendlier inspect

# File lib/UPnP/SSDP.rb, line 316
def inspect
  "#<#{self.class}:0x#{object_id.to_s 16} #{target}>"
end