Class: RubyHome::Service
- Inherits:
-
Object
- Object
- RubyHome::Service
- Defined in:
- lib/ruby_home/service.rb
Instance Attribute Summary collapse
-
#accessory ⇒ Object
readonly
Returns the value of attribute accessory.
-
#characteristics ⇒ Object
readonly
Returns the value of attribute characteristics.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#hidden ⇒ Object
readonly
Returns the value of attribute hidden.
-
#instance_id ⇒ Object
Returns the value of attribute instance_id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#primary ⇒ Object
readonly
Returns the value of attribute primary.
-
#uuid ⇒ Object
readonly
Returns the value of attribute uuid.
Instance Method Summary collapse
- #accessory_id ⇒ Object
- #characteristic(characteristic_name) ⇒ Object
- #contains_instance_id?(instance_id) ⇒ Boolean
-
#initialize(accessory:, primary: false, hidden: false, name:, description:, uuid:) ⇒ Service
constructor
A new instance of Service.
Constructor Details
#initialize(accessory:, primary: false, hidden: false, name:, description:, uuid:) ⇒ Service
7 8 9 10 11 12 13 14 15 |
# File 'lib/ruby_home/service.rb', line 7 def initialize(accessory: , primary: false, hidden: false, name:, description:, uuid:) @accessory = accessory @primary = primary @hidden = hidden @name = name @description = description @uuid = uuid @characteristics = CharacteristicCollection.new end |
Instance Attribute Details
#accessory ⇒ Object (readonly)
Returns the value of attribute accessory.
17 18 19 |
# File 'lib/ruby_home/service.rb', line 17 def accessory @accessory end |
#characteristics ⇒ Object (readonly)
Returns the value of attribute characteristics.
17 18 19 |
# File 'lib/ruby_home/service.rb', line 17 def characteristics @characteristics end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
17 18 19 |
# File 'lib/ruby_home/service.rb', line 17 def description @description end |
#hidden ⇒ Object (readonly)
Returns the value of attribute hidden.
17 18 19 |
# File 'lib/ruby_home/service.rb', line 17 def hidden @hidden end |
#instance_id ⇒ Object
Returns the value of attribute instance_id.
17 18 19 |
# File 'lib/ruby_home/service.rb', line 17 def instance_id @instance_id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
17 18 19 |
# File 'lib/ruby_home/service.rb', line 17 def name @name end |
#primary ⇒ Object (readonly)
Returns the value of attribute primary.
17 18 19 |
# File 'lib/ruby_home/service.rb', line 17 def primary @primary end |
#uuid ⇒ Object (readonly)
Returns the value of attribute uuid.
17 18 19 |
# File 'lib/ruby_home/service.rb', line 17 def uuid @uuid end |
Instance Method Details
#accessory_id ⇒ Object
38 39 40 |
# File 'lib/ruby_home/service.rb', line 38 def accessory_id accessory.id end |
#characteristic(characteristic_name) ⇒ Object
42 43 44 45 46 |
# File 'lib/ruby_home/service.rb', line 42 def characteristic(characteristic_name) characteristics.find do |characteristic| characteristic.name == characteristic_name end end |
#contains_instance_id?(instance_id) ⇒ Boolean
34 35 36 |
# File 'lib/ruby_home/service.rb', line 34 def contains_instance_id?(instance_id) self.instance_id == instance_id || characteristics.contains_instance_id?(instance_id) end |