Class: Discover::Service::Update

Inherits:
Struct
  • Object
show all
Defined in:
lib/discover.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#addressObject

Returns the value of attribute address



121
122
123
# File 'lib/discover.rb', line 121

def address
  @address
end

#attributesObject

Returns the value of attribute attributes



121
122
123
# File 'lib/discover.rb', line 121

def attributes
  @attributes
end

#createdObject

Returns the value of attribute created



121
122
123
# File 'lib/discover.rb', line 121

def created
  @created
end

#nameObject

Returns the value of attribute name



121
122
123
# File 'lib/discover.rb', line 121

def name
  @name
end

#onlineObject

Returns the value of attribute online



121
122
123
# File 'lib/discover.rb', line 121

def online
  @online
end

Class Method Details

.from_hash(hash) ⇒ Object



122
123
124
# File 'lib/discover.rb', line 122

def self.from_hash(hash)
  new *hash.values_at("Addr", "Attrs", "Created", "Name", "Online")
end

Instance Method Details

#offline?Boolean



134
135
136
# File 'lib/discover.rb', line 134

def offline?
  !online?
end

#online?Boolean



130
131
132
# File 'lib/discover.rb', line 130

def online?
  online == true
end

#sentinel?Boolean

The sentinel update marks the end of existing updates from discoverd



139
140
141
# File 'lib/discover.rb', line 139

def sentinel?
  address.empty? && name.empty?
end