Class: OpenHAB::DSL::Things::Builder
- Inherits:
 - 
      Object
      
        
- Object
 - OpenHAB::DSL::Things::Builder
 
 
- Defined in:
 - lib/openhab/dsl/things/builder.rb
 
Overview
A thing builder allows you to dynamically create openHAB things at runtime. This can be useful either to create things as soon as the script loads, or even later based on a rule executing.
Instance Attribute Summary collapse
Instance Method Summary collapse
- 
  
    
      #bridge(*args, **kwargs, &block)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Create a new Bridge.
 - 
  
    
      #initialize(provider, update: false)  ⇒ Builder 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of Builder.
 - 
  
    
      #thing(*args, **kwargs, &block)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Create a new Thing.
 
Constructor Details
#initialize(provider, update: false) ⇒ Builder
Returns a new instance of Builder.
      43 44 45 46  | 
    
      # File 'lib/openhab/dsl/things/builder.rb', line 43 def initialize(provider, update: false) @provider = Core::Things::Provider.current(provider) @update = update end  | 
  
Instance Attribute Details
#provider ⇒ org.openhab.core.thing.ManagedThingProvider (readonly)
      41 42 43  | 
    
      # File 'lib/openhab/dsl/things/builder.rb', line 41 def provider @provider end  | 
  
Instance Method Details
#bridge(*args, **kwargs, &block) ⇒ Object
Create a new Bridge
      50 51 52  | 
    
      # File 'lib/openhab/dsl/things/builder.rb', line 50 def bridge(*args, **kwargs, &block) build(BridgeBuilder, *args, **kwargs, &block) end  | 
  
#thing(*args, **kwargs, &block) ⇒ Object
Create a new Thing
      56 57 58  | 
    
      # File 'lib/openhab/dsl/things/builder.rb', line 56 def thing(*args, **kwargs, &block) build(ThingBuilder, *args, **kwargs, &block) end  |