Class: Domotics::Core::Device
Direct Known Subclasses
Constant Summary collapse
- @@devices =
{}
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
- #destroy ⇒ Object
-
#initialize(args = {}) ⇒ Device
constructor
A new instance of Device.
- #to_s ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Device
Returns a new instance of Device.
5 6 7 8 9 |
# File 'lib/domotics/core/device.rb', line 5 def initialize(args = {}) @name = args[:name] || SecureRandom.hex @@devices[@name] = self @type = args[:type] || "undefined" end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/domotics/core/device.rb', line 4 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
4 5 6 |
# File 'lib/domotics/core/device.rb', line 4 def type @type end |
Class Method Details
.[](symbol = nil) ⇒ Object
11 12 13 14 |
# File 'lib/domotics/core/device.rb', line 11 def self.[](symbol = nil) return @@devices[symbol] if symbol @@devices end |