Class: OpenHAB::Core::Items::Persistence::PersistedState
- Inherits:
 - 
      SimpleDelegator
      
        
- Object
 - SimpleDelegator
 - OpenHAB::Core::Items::Persistence::PersistedState
 
 
- Defined in:
 - lib/openhab/core/items/persistence.rb
 
Overview
A wrapper for HistoricItem that delegates to its state.
A PersistedState object can be directly used in arithmetic operations with State and other PersistedState objects.
Instance Attribute Summary collapse
- 
  
    
      #name  ⇒ String 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Item name.
 - #state ⇒ Types::State readonly
 - #timestamp ⇒ ZonedDateTime readonly
 
Instance Method Summary collapse
- 
  
    
      #initialize(historic_item, state = nil)  ⇒ PersistedState 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of PersistedState.
 
Constructor Details
#initialize(historic_item, state = nil) ⇒ PersistedState
Returns a new instance of PersistedState.
      96 97 98 99  | 
    
      # File 'lib/openhab/core/items/persistence.rb', line 96 def initialize(historic_item, state = nil) @historic_item = historic_item super(state || historic_item.state) end  | 
  
Instance Attribute Details
#name ⇒ String (readonly)
Returns Item name.
      94  | 
    
      # File 'lib/openhab/core/items/persistence.rb', line 94 delegate %i[timestamp name] => :@historic_item  | 
  
#state ⇒ Types::State (readonly)
      86  | 
    
      # File 'lib/openhab/core/items/persistence.rb', line 86 alias_method :state, :__getobj__  |