Class: LazyList::MemoPromise

Inherits:
Promise show all
Defined in:
lib/lazylist.rb

Overview

A promise that can be evaluated on demand (if forced), that caches its value.

Instance Method Summary collapse

Methods inherited from Promise

#initialize, #method_missing

Constructor Details

This class inherits a constructor from LazyList::Promise

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class LazyList::Promise

Instance Method Details

#__value__Object

Return the value of this Promise and memoize it for later access.



221
222
223
224
225
226
227
# File 'lib/lazylist.rb', line 221

def __value__
  if defined?(@value)
    @value
  else
    @value = super
  end
end