class Taskinator::Persistence::LazyLoader
lazily loads the object specified by the type and uuid
Public Class Methods
new(type, uuid, instance_cache={})
click to toggle source
NOTE: the instance cached is passed from the first deserializer onto the next one, to prevent needing to keep loading the same objects again.
E.g. this is useful for tasks which refer to their parent processes
# File lib/taskinator/persistence.rb, line 628 def initialize(type, uuid, instance_cache={}) @type = type @uuid = uuid @instance_cache = instance_cache end
Public Instance Methods
__getobj__()
click to toggle source
# File lib/taskinator/persistence.rb, line 634 def __getobj__ # only fetch the object as needed # and memoize for subsequent calls @instance ||= @type.fetch(@uuid, @instance_cache) end