class Domotics::Core::Device

Attributes

name[R]
type[R]

Public Class Methods

[](symbol = nil) click to toggle source
# File lib/domotics/core/device.rb, line 11
def self.[](symbol = nil)
  return @@devices[symbol] if symbol
  @@devices
end
new(args = {}) click to toggle source
# File lib/domotics/core/device.rb, line 5
def initialize(args = {})
  @name = args[:name] || SecureRandom.hex
  @@devices[@name] = self
  @type = args[:type] || "undefined"
end

Public Instance Methods

destroy() click to toggle source
# File lib/domotics/core/device.rb, line 16
def destroy
  @@devices[@name] = nil
end
to_s() click to toggle source
# File lib/domotics/core/device.rb, line 19
def to_s
  "Room[#{@name}](id:#{__id__})"
end