Class: Asynchronic::DataStore::LazyValue

Inherits:
TransparentProxy
  • Object
show all
Defined in:
lib/asynchronic/data_store/lazy_value.rb

Instance Method Summary collapse

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_storeObject



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

#inspectObject



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

#reloadObject



11
12
13
14
# File 'lib/asynchronic/data_store/lazy_value.rb', line 11

def reload
  @value = nil
  self
end

#to_valueObject



24
25
26
# File 'lib/asynchronic/data_store/lazy_value.rb', line 24

def to_value
  __getobj__
end