diff --git a/lib/pry/pry_class.rb b/lib/pry/pry_class.rb index 1ee5049f..956342c6 100644 --- a/lib/pry/pry_class.rb +++ b/lib/pry/pry_class.rb @@ -116,7 +116,12 @@ class Pry pry_instance.backtrace = caller.tap(&:shift) # yield the binding_stack to the hook for modification - Pry.config.hooks.exec_hook(:when_started, binding_stack = [target], pry_instance) + Pry.config.hooks.exec_hook( + :when_started, + binding_stack = [target], + options, + pry_instance + ) head, *tail = binding_stack pry_instance.binding_stack.push(*tail) diff --git a/test/test_hooks.rb b/test/test_hooks.rb index 2eddb06b..f4d79f2f 100644 --- a/test/test_hooks.rb +++ b/test/test_hooks.rb @@ -171,5 +171,15 @@ describe Pry::Hooks do @hooks.add_hook(:test_hook, :my_name3) { 3 } @hooks.exec_hook(:test_hook).should == 3 end + + it 'should take a hash containing custom options' do + number = 0 + callable = proc { |options| number = options[:number] } + + @hooks.add_hook(:test_with_options, :test_hook, callable) + @hooks.exec_hook(:test_with_options, :number => 10) + + number.should == 10 + end end end