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
-
#instant ⇒ Instant
readonly
The timestamp as an Instant.
-
#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.
100 101 102 103 |
# File 'lib/openhab/core/items/persistence.rb', line 100 def initialize(historic_item, state = nil) @historic_item = historic_item super(state || historic_item.state) end |
Instance Attribute Details
#instant ⇒ Instant (readonly)
Returns The timestamp as an Instant.
|
# File 'lib/openhab/core/items/persistence.rb', line 91
|
#name ⇒ String (readonly)
Returns Item name.
98 |
# File 'lib/openhab/core/items/persistence.rb', line 98 delegate %i[timestamp instant name] => :@historic_item |
#state ⇒ Types::State (readonly)
86 |
# File 'lib/openhab/core/items/persistence.rb', line 86 alias_method :state, :__getobj__ |