module Pry::Config::Behavior::Builder

Public Instance Methods

assign(attributes, default = nil) click to toggle source

Returns a new Behavior, non-recursively (unlike {#from_hash}).

@param

(see #from_hash)

@return

(see #from_hash)
# File lib/pry/config/behavior.rb, line 19
def assign(attributes, default = nil)
  new(default).tap do |behavior|
    behavior.merge!(attributes)
  end
end
from_hash(attributes, default = nil) click to toggle source

Returns a new Behavior, recursively walking attributes.

@param [Hash] attributes

a hash to initialize an instance of self with.

@param [Pry::Config, nil] default

a default, or nil for none.

@return [Pry::Config]

returns an instance of self.
# File lib/pry/config/behavior.rb, line 37
def from_hash(attributes, default = nil)
  new(default).tap do |config|
    attributes.each do |key,value|
      config[key] = Hash === value ? from_hash(value, nil) : value
    end
  end
end