class Asynchronic::DataStore::LazyValue

Attributes

data_store_class[R]
data_store_connection_args[R]
key[R]

Public Class Methods

new(data_store, key) click to toggle source
# 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

Public Instance Methods

data_store() click to toggle source
# File lib/asynchronic/data_store/lazy_value.rb, line 20
def data_store
  data_store_class.connect(*data_store_connection_args)
end
inspect() click to toggle source
# 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() click to toggle source
# File lib/asynchronic/data_store/lazy_value.rb, line 11
def reload
  @value = nil
  self
end
to_value() click to toggle source
# File lib/asynchronic/data_store/lazy_value.rb, line 24
def to_value
  __getobj__
end

Private Instance Methods

__getobj__() click to toggle source
# File lib/asynchronic/data_store/lazy_value.rb, line 32
def __getobj__
  @value ||= data_store[key]
end