Class: RubyHome::CharacteristicFactory
- Inherits:
-
Object
- Object
- RubyHome::CharacteristicFactory
- Defined in:
- lib/ruby_home/factories/characteristic_factory.rb
Constant Summary collapse
- DEFAULT_VALUES =
{ firmware_revision: '1.0', identify: nil, manufacturer: 'Default-Manufacturer', model: 'Default-Model', name: 'RubyHome', serial_number: 'Default-SerialNumber', }.freeze
Class Method Summary collapse
Instance Method Summary collapse
- #create {|characteristic| ... } ⇒ Object
-
#initialize(characteristic_name, options) ⇒ CharacteristicFactory
constructor
A new instance of CharacteristicFactory.
Constructor Details
#initialize(characteristic_name, options) ⇒ CharacteristicFactory
Returns a new instance of CharacteristicFactory.
16 17 18 19 |
# File 'lib/ruby_home/factories/characteristic_factory.rb', line 16 def initialize(characteristic_name, ) @characteristic_name = characteristic_name = end |
Class Method Details
.create(characteristic_name, options = {}, &block) ⇒ Object
12 13 14 |
# File 'lib/ruby_home/factories/characteristic_factory.rb', line 12 def self.create(characteristic_name, ={}, &block) new(characteristic_name, ).create(&block) end |
Instance Method Details
#create {|characteristic| ... } ⇒ Object
21 22 23 24 25 26 |
# File 'lib/ruby_home/factories/characteristic_factory.rb', line 21 def create yield characteristic if block_given? characteristic.save characteristic end |