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

Returns:

  • (Object)

    the current value of address



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

def address
  @address
end

#attributesObject

Returns the value of attribute attributes

Returns:

  • (Object)

    the current value of attributes



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

def attributes
  @attributes
end

#createdObject

Returns the value of attribute created

Returns:

  • (Object)

    the current value of created



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

def created
  @created
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



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

def name
  @name
end

#onlineObject

Returns the value of attribute online

Returns:

  • (Object)

    the current value of online



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

def online
  @online
end

Class Method Details

.from_hash(hash) ⇒ Object



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

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

Instance Method Details

#offline?Boolean

Returns:

  • (Boolean)


142
143
144
# File 'lib/discover.rb', line 142

def offline?
  !online?
end

#online?Boolean

Returns:

  • (Boolean)


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

def online?
  online == true
end

#sentinel?Boolean

The sentinel update marks the end of existing updates from discoverd

Returns:

  • (Boolean)


147
148
149
# File 'lib/discover.rb', line 147

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