Class: OpenHAB::Core::Items::StateStorage
- Inherits:
- 
      SimpleDelegator
      
        - Object
- SimpleDelegator
- OpenHAB::Core::Items::StateStorage
 
- Defined in:
- lib/openhab/core/items/state_storage.rb
Overview
Delegates state storage to a Hash providing methods to operate with states
Instance Method Summary collapse
- 
  
    
      #changed?  ⇒ true, false 
    
    
  
  
  
  
  
  
  
  
  
    Detect if any items have changed states since being stored. 
- 
  
    
      #restore  ⇒ void 
    
    
  
  
  
  
  
  
  
  
  
    Restore the stored states of all items. 
- 
  
    
      #restore_changes  ⇒ void 
    
    
  
  
  
  
  
  
  
  
  
    Restore states for items that have changed. 
Instance Method Details
#changed? ⇒ true, false
Detect if any items have changed states since being stored
| 47 48 49 | # File 'lib/openhab/core/items/state_storage.rb', line 47 def changed? any? { |item, value| item.state != value } end | 
#restore ⇒ void
This method returns an undefined value.
Restore the stored states of all items
| 29 30 31 | # File 'lib/openhab/core/items/state_storage.rb', line 29 def restore $events.restore_states(to_h) end | 
#restore_changes ⇒ void
This method returns an undefined value.
Restore states for items that have changed
| 38 39 40 | # File 'lib/openhab/core/items/state_storage.rb', line 38 def restore_changes $events.restore_states(select { |item, value| item.state != value }) end | 
 
          