Class: Pry::Config::MemoizedValue Private
- Defined in:
- lib/pry/config/memoized_value.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
MemoizedValue is a Proc (block) wrapper. It is meant to be used as a configuration value. Subsequent ‘#call` calls return the same memoized result.
Instance Method Summary collapse
- #call ⇒ Object private
-
#initialize(&block) ⇒ MemoizedValue
constructor
private
A new instance of MemoizedValue.
Constructor Details
#initialize(&block) ⇒ MemoizedValue
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of MemoizedValue.
20 21 22 23 24 |
# File 'lib/pry/config/memoized_value.rb', line 20 def initialize(&block) @block = block @called = false @call = nil end |
Instance Method Details
#call ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
26 27 28 29 30 31 |
# File 'lib/pry/config/memoized_value.rb', line 26 def call return @call if @called @called = true @call = @block.call end |