1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

add assign(), fix #1726

This commit is contained in:
r-obert 2017-12-22 22:22:10 +01:00 committed by r-obert
parent 97c1493e16
commit af78a57523
2 changed files with 18 additions and 2 deletions

View file

@ -5,6 +5,23 @@ module Pry::Config::Behavior
ReservedKeyError = Class.new(RuntimeError)
module Builder
#
# Returns a new Behavior, non-recursively (unlike {#from_hash}).
#
# @param
# (see #from_hash)
#
# @return
# (see #from_hash)
#
def assign(attributes, default = nil)
new(default).tap do |behavior|
behavior.merge!(attributes)
end
end
#
# Returns a new Behavior, recursively walking attributes.
#
# @param [Hash] attributes
# a hash to initialize an instance of self with.

View file

@ -532,8 +532,7 @@ class Pry
open_token = @indent.open_delimiters.any? ? @indent.open_delimiters.last :
@indent.stack.last
c = Pry::Config.new(nil)
c.merge!({
c = Pry::Config.assign({
:object => object,
:nesting_level => binding_stack.size - 1,
:open_token => open_token,