1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

Merge branch 'master' of https://github.com/YorickPeterse/pry into yorick-master

This commit is contained in:
John Mair 2012-01-03 19:04:11 +13:00
commit 856aaaed81
2 changed files with 16 additions and 1 deletions

View file

@ -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)

View file

@ -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