diff --git a/lib/pry/hooks.rb b/lib/pry/hooks.rb index f234ab5a..f902d58e 100644 --- a/lib/pry/hooks.rb +++ b/lib/pry/hooks.rb @@ -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) diff --git a/lib/pry/pry_class.rb b/lib/pry/pry_class.rb index c3cb2ada..296ba23d 100644 --- a/lib/pry/pry_class.rb +++ b/lib/pry/pry_class.rb @@ -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 diff --git a/lib/pry/pry_instance.rb b/lib/pry/pry_instance.rb index 138cd403..e2b287e6 100644 --- a/lib/pry/pry_instance.rb +++ b/lib/pry/pry_instance.rb @@ -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