mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
coerce :hooks (as a Hash) to Pry::Hooks instance in Pry.start().
This commit is contained in:
parent
325016eb3a
commit
fea2e22c0d
3 changed files with 3 additions and 2 deletions
|
@ -18,6 +18,7 @@ class Pry
|
|||
# @param [Hash] hash The hash to convert to `Pry::Hooks`.
|
||||
# @return [Pry::Hooks] The resulting `Pry::Hooks` instance.
|
||||
def self.from_hash(hash)
|
||||
return hash if hash.instance_of?(self)
|
||||
instance = new
|
||||
hash.each do |k, v|
|
||||
instance.add_hook(k, nil, v)
|
||||
|
|
|
@ -119,7 +119,7 @@ class Pry
|
|||
end
|
||||
|
||||
options[:target] = Pry.binding_for(target || toplevel_binding)
|
||||
|
||||
options[:hooks] = Pry::Hooks.from_hash options.delete(:hooks) if options.key?(:hooks)
|
||||
initial_session_setup
|
||||
|
||||
# Unless we were given a backtrace, save the current one
|
||||
|
|
|
@ -68,7 +68,7 @@ class Pry
|
|||
@eval_string = ""
|
||||
@backtrace = options[:backtrace] || caller
|
||||
@config = Pry::Config.new
|
||||
@config.merge!(options)
|
||||
config.merge!(options)
|
||||
push_prompt(config.prompt)
|
||||
@input_array = Pry::HistoryArray.new config.memory_size
|
||||
@output_array = Pry::HistoryArray.new config.memory_size
|
||||
|
|
Loading…
Reference in a new issue