Class: Dashbeautiful::Device
- Inherits:
-
Object
- Object
- Dashbeautiful::Device
- Defined in:
- lib/dashbeautiful/device.rb
Overview
description TODO
Direct Known Subclasses
ApplianceDevice, CameraDevice, CombinedDevice, SwitchDevice, WirelessDevice
Instance Attribute Summary collapse
-
#mac ⇒ Object
readonly
Returns the value of attribute mac.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#network ⇒ Object
readonly
Returns the value of attribute network.
-
#serial ⇒ Object
readonly
Returns the value of attribute serial.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(network, **attributes) ⇒ Device
constructor
A new instance of Device.
Constructor Details
#initialize(network, **attributes) ⇒ Device
Returns a new instance of Device.
23 24 25 26 27 28 29 30 |
# File 'lib/dashbeautiful/device.rb', line 23 def initialize(network, **attributes) @network = network @name = attributes[:name] @serial = attributes[:serial] @mac = attributes[:mac] @model = attributes[:model] @tags = attributes[:tags] end |
Instance Attribute Details
#mac ⇒ Object (readonly)
Returns the value of attribute mac.
4 5 6 |
# File 'lib/dashbeautiful/device.rb', line 4 def mac @mac end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
4 5 6 |
# File 'lib/dashbeautiful/device.rb', line 4 def model @model end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/dashbeautiful/device.rb', line 4 def name @name end |
#network ⇒ Object (readonly)
Returns the value of attribute network.
4 5 6 |
# File 'lib/dashbeautiful/device.rb', line 4 def network @network end |
#serial ⇒ Object (readonly)
Returns the value of attribute serial.
4 5 6 |
# File 'lib/dashbeautiful/device.rb', line 4 def serial @serial end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
4 5 6 |
# File 'lib/dashbeautiful/device.rb', line 4 def @tags end |
Class Method Details
.all(network) ⇒ Object
17 18 19 20 21 |
# File 'lib/dashbeautiful/device.rb', line 17 def self.all(network) raise ArgumentError, 'must pass a Network' if network.nil? network.devices end |
.create(*args, **kwargs) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/dashbeautiful/device.rb', line 6 def self.create(*args, **kwargs) type = case kwargs[:model] when /MV/ then CameraDevice when /MS/ then SwitchDevice when /MR/ then WirelessDevice when /MX/ then ApplianceDevice else Device end type.new(*args, **kwargs) end |