* Shows a deprecation warning when used with a link to the new `Pry::Hooks` documentation.
* When hash-based hooks are used they create anonymous hooks for the associated event.
i.e Pry.hooks = { :before_session => proc { puts 'hi' } }, the 'name' of that hook is `nil`.
* Anonymous hooks (nil-named) are different to ordinary hooks in that they dont raise an exception when user attempts to define another of the same name, they just silently overwrite previous one. This is to
mimic the old hash-based behaviour.
* Pry::Hooks[] and Pry::Hooks[]= are defined too, and they get and set the anonymous hook for the given event, i.e hooks[:before_session] = proc { "hi" } is equivalent to: hook.add_hook(:before_session, nil,
proc { "hi" })
* Proc::Hook#[] and Pry::Hooks#[]= also display deprecation warnings.
We no longer wish to support the (undocumented!!) hash-based hooks API. When a user attempts to use this API
Pry will raise a `Pry::ObsoleteError` exception with a message telling them to use `Pry::Hooks` instead.
The rationale for this is simple: you add hooks to enhance the core
functionality with added niceness, so you don't want a buggy hook to
break core functionality.
If you call exec_hook via an instance of Pry, it will additionally print
a warning to output whenever such an exception occurs, giving useful
information on how to debug the problem.
Also the return value of exec_hook() is now the value of the last executed hook.
Internally, hooks now use arrays (rather than hash). Also added a get_hooks() method.
Updated tests to reflect these changes.
for `read_between_lines` function commands.rb. Removed before/after
hook output text (too spammy). Fixed file-mode completion, so it works
straight away. CHanged 'pry' rake task to 'binding.pry' instead of
just 'pry' so that context is given.
* added :__script__ test to hooks too
* raise was due to top-level rubinius __method__ returning :__script__
and not simply returning nil (like MRI/JRUBY)
* Fix was to include :__script__ in the test.
* also slightly improved working in README.markdown
* Commands now completely manages 'help', so that 'help' returns full command list/doco and 'help cmd' returns doc for just that command
* Turned out.session_start() and out.session_end() into hook methods: Pry.hooks :before_session, and :after_session
* Refactored Pry#initialize, so no longer individually setting accessors and hash options, instead using ConfigOptions to iterate over accessors and set their default value to Pry.send(accessor_name)
* TO DO: rewrite tests in terms of new program structure, since they're all failing due to major change (not because functionality is lacking but due to assumptions tests were making about program structure)