Class: Bridge
- Inherits:
-
Object
- Object
- Bridge
- Defined in:
- lib/lights/bridge.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#ip ⇒ Object
readonly
Returns the value of attribute ip.
-
#mac ⇒ Object
readonly
Returns the value of attribute mac.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #data ⇒ Object
-
#initialize(data = {}) ⇒ Bridge
constructor
A new instance of Bridge.
Constructor Details
#initialize(data = {}) ⇒ Bridge
Returns a new instance of Bridge.
5 6 7 8 9 10 |
# File 'lib/lights/bridge.rb', line 5 def initialize(data = {}) @id = data["id"] @ip = data["internalipaddress"] @mac = data["macaddress"] @name = data["name"] end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/lights/bridge.rb', line 3 def id @id end |
#ip ⇒ Object (readonly)
Returns the value of attribute ip.
3 4 5 |
# File 'lib/lights/bridge.rb', line 3 def ip @ip end |
#mac ⇒ Object (readonly)
Returns the value of attribute mac.
3 4 5 |
# File 'lib/lights/bridge.rb', line 3 def mac @mac end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/lights/bridge.rb', line 3 def name @name end |
Instance Method Details
#data ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/lights/bridge.rb', line 12 def data data = {} data["id"] = @id if @id data["internalipaddress"] = @ip if @ip data["macaddress"] = @mac if @mac data["name"] = @name if @name data end |