Class: Pry::Config::LazyValue Private

Inherits:
Object
  • Object
show all
Defined in:
lib/pry/config/lazy_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.

LazyValue is a Proc (block) wrapper. It is meant to be used as a configuration value. Subsequent #call calls always evaluate the given block.

Examples:

num = 19
value = Pry::Config::LazyValue.new { num += 1 }
value.foo # => 20
value.foo # => 21
value.foo # => 22

See Also:

Since:

  • v0.13.0

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ LazyValue

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 LazyValue.

Since:

  • v0.13.0


20
21
22
# File 'lib/pry/config/lazy_value.rb', line 20

def initialize(&block)
  @block = block
end

Instance Method Details

#callObject

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.

Since:

  • v0.13.0


24
25
26
# File 'lib/pry/config/lazy_value.rb', line 24

def call
  @block.call
end