Class: MQTT::Homie::Base
- Inherits:
-
Object
- Object
- MQTT::Homie::Base
- Defined in:
- lib/mqtt/homie/base.rb
Constant Summary collapse
- REGEX =
"[a-z0-9][a-z0-9-]*"
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(id, name) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(id, name) ⇒ Base
Returns a new instance of Base.
10 11 12 13 14 15 |
# File 'lib/mqtt/homie/base.rb', line 10 def initialize(id, name) raise ArgumentError, "Invalid Homie ID '#{id}'" unless id.is_a?(String) && id =~ Regexp.new("^#{REGEX}$") @id = id @name = name end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
8 9 10 |
# File 'lib/mqtt/homie/base.rb', line 8 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/mqtt/homie/base.rb', line 8 def name @name end |