Class: Asynchronic::DataStore::LazyValue
- Inherits:
-
TransparentProxy
- Object
- TransparentProxy
- Asynchronic::DataStore::LazyValue
- Defined in:
- lib/asynchronic/data_store/lazy_value.rb
Instance Method Summary collapse
- #data_store ⇒ Object
-
#initialize(data_store, key) ⇒ LazyValue
constructor
A new instance of LazyValue.
- #inspect ⇒ Object
- #reload ⇒ Object
- #to_value ⇒ Object
Constructor Details
#initialize(data_store, key) ⇒ LazyValue
Returns a new instance of LazyValue.
5 6 7 8 9 |
# File 'lib/asynchronic/data_store/lazy_value.rb', line 5 def initialize(data_store, key) @data_store_class = data_store.class @data_store_connection_args = data_store.connection_args @key = key end |
Instance Method Details
#data_store ⇒ Object
20 21 22 |
# File 'lib/asynchronic/data_store/lazy_value.rb', line 20 def data_store data_store_class.connect(*data_store_connection_args) end |
#inspect ⇒ Object
16 17 18 |
# File 'lib/asynchronic/data_store/lazy_value.rb', line 16 def inspect "#<#{proxy_class} @data_store_class=#{data_store_class} @data_store_connection_args=#{data_store_connection_args} @key=#{key}>" end |
#reload ⇒ Object
11 12 13 14 |
# File 'lib/asynchronic/data_store/lazy_value.rb', line 11 def reload @value = nil self end |
#to_value ⇒ Object
24 25 26 |
# File 'lib/asynchronic/data_store/lazy_value.rb', line 24 def to_value __getobj__ end |