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.
19 20 21 22 |
# File 'lib/ruby_home/factories/characteristic_factory.rb', line 19 def initialize(characteristic_name, ) @characteristic_name = characteristic_name = end |
Class Method Details
.create(characteristic_name, options = {}, &block) ⇒ Object
15 16 17 |
# File 'lib/ruby_home/factories/characteristic_factory.rb', line 15 def self.create(characteristic_name, ={}, &block) new(characteristic_name, ).create(&block) end |
Instance Method Details
#create {|characteristic| ... } ⇒ Object
24 25 26 27 28 29 |
# File 'lib/ruby_home/factories/characteristic_factory.rb', line 24 def create yield characteristic if block_given? characteristic.save characteristic end |