mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
27 lines
510 B
Ruby
27 lines
510 B
Ruby
|
class Pry
|
||
|
class Config < Pry::BasicObject
|
||
|
# Wraps a block so it can have a name.
|
||
|
#
|
||
|
# @example
|
||
|
# proc1 = proc {}
|
||
|
# proc2 = Pry::Config::Lazy.new(&proc {})
|
||
|
#
|
||
|
# proc1.is_a?(Pry::Config::Lazy)
|
||
|
# #=> false
|
||
|
# proc2.is_a?(Pry::Config::Lazy)
|
||
|
# #=> true
|
||
|
#
|
||
|
# @api private
|
||
|
# @since v0.12.0
|
||
|
class Lazy
|
||
|
def initialize(&block)
|
||
|
@block = block
|
||
|
end
|
||
|
|
||
|
# @return [Object]
|
||
|
def call
|
||
|
@block.call
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|