Class: OpenHAB::Core::Rules::Registry
- Inherits:
 - 
      Object
      
        
- Object
 - OpenHAB::Core::Rules::Registry
 
 
- Includes:
 - LazyArray
 
- Defined in:
 - lib/openhab/core/rules/registry.rb
 
Overview
Provides access to all openHAB rules, and acts like an array.
Instance Method Summary collapse
- 
  
    
      #[](uid)  ⇒ Rule? 
    
    
      (also: #include?, #key?, #has_key?)
    
  
  
  
  
  
  
  
  
  
    
Gets a specific Rule.
 - 
  
    
      #build(preferred_provider = nil) { ... } ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Enter the Rule Builder DSL.
 - 
  
    
      #remove(rule_uid)  ⇒ Rule? 
    
    
  
  
  
  
  
  
  
  
  
    
Remove a Rule.
 - 
  
    
      #scenes  ⇒ Array<Rule> 
    
    
  
  
  
  
  
  
  
  
  
    
Returns all Scenes (rules tagged with "Scene").
 - 
  
    
      #scripts  ⇒ Array<Rule> 
    
    
  
  
  
  
  
  
  
  
  
    
Returns all Scripts (rules tagged with "Script").
 - 
  
    
      #to_a  ⇒ Array<Rule> 
    
    
  
  
  
  
  
  
  
  
  
    
Explicit conversion to array.
 
Methods included from LazyArray
#each, #method_missing, #to_ary
Methods included from Enumerable
#all_groups, #all_members, #command, #decrease, #down, #equipments, #fast_forward, #groups, #increase, #locations, #member_of, #members, #move, #next, #not_member_of, #not_tagged, #off, #on, #pause, #play, #points, #previous, #refresh, #rewind, #stop, #tagged, #up, #update
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class OpenHAB::Core::LazyArray
Instance Method Details
#[](uid) ⇒ Rule? Also known as: include?, key?, has_key?
Gets a specific Rule
      21 22 23  | 
    
      # File 'lib/openhab/core/rules/registry.rb', line 21 def [](uid) $rules.get(uid) end  | 
  
#build(preferred_provider = nil) { ... } ⇒ Object
Enter the Rule Builder DSL.
      44 45 46  | 
    
      # File 'lib/openhab/core/rules/registry.rb', line 44 def build(preferred_provider = nil, &block) DSL::Rules::Builder.new(preferred_provider).instance_eval_with_dummy_items(&block) end  | 
  
#remove(rule_uid) ⇒ Rule?
Remove a Rule.
The rule must be a managed thing (typically created by Ruby or in the UI).
      64 65 66 67 68 69 70 71 72  | 
    
      # File 'lib/openhab/core/rules/registry.rb', line 64 def remove(rule_uid) rule_uid = rule_uid.uid if rule_uid.is_a?(Rule) provider = Provider.registry.provider_for(rule_uid) unless provider.is_a?(org.openhab.core.common.registry.ManagedProvider) raise "Cannot remove rule #{rule_uid} from non-managed provider #{provider.inspect}" end provider.remove(rule_uid) end  | 
  
#scenes ⇒ Array<Rule>
Returns all Scenes (rules tagged with "Scene")
      79 80 81  | 
    
      # File 'lib/openhab/core/rules/registry.rb', line 79 def scenes tagged("Scene") end  |