Class: RubyHome::AccessoryFactory
- Inherits:
-
Object
- Object
- RubyHome::AccessoryFactory
- Defined in:
- lib/ruby_home/factories/accessory_factory.rb
Class Method Summary collapse
Instance Method Summary collapse
- #create {|service| ... } ⇒ Object
-
#initialize(service_name, accessory_options, characteristic_options) ⇒ AccessoryFactory
constructor
A new instance of AccessoryFactory.
Constructor Details
#initialize(service_name, accessory_options, characteristic_options) ⇒ AccessoryFactory
Returns a new instance of AccessoryFactory.
12 13 14 15 16 |
# File 'lib/ruby_home/factories/accessory_factory.rb', line 12 def initialize(service_name, , ) @service_name = service_name @accessory_options = @characteristic_options = end |
Class Method Details
.create(service_name, characteristics: {}, **options) ⇒ Object
8 9 10 |
# File 'lib/ruby_home/factories/accessory_factory.rb', line 8 def self.create(service_name, characteristics: {}, **) new(service_name, , characteristics).create end |
Instance Method Details
#create {|service| ... } ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/ruby_home/factories/accessory_factory.rb', line 18 def create yield service if block_given? create_accessory_information service.save create_required_characteristics create_optional_characteristics service end |