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:
parent
97c1493e16
commit
af78a57523
2 changed files with 18 additions and 2 deletions
|
@ -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.
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Reference in a new issue