From bc9c75e54693d9241e96b3a24d2acd92f69f1a6f Mon Sep 17 00:00:00 2001 From: Robert Gleeson Date: Mon, 20 Jan 2014 23:02:23 +0100 Subject: [PATCH] support old Pry#hooks= API (argument as a Hash) on Pry::Config. --- lib/pry/config.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/pry/config.rb b/lib/pry/config.rb index a985711c..8c5fd456 100644 --- a/lib/pry/config.rb +++ b/lib/pry/config.rb @@ -58,6 +58,20 @@ class Pry::Config @lookup end + # + # FIXME + # @param [Pry::Hooks] hooks + # + def hooks=(hooks) + if hooks.is_a?(Hash) + warn "Hash-based hooks are now deprecated! Use a `Pry::Hooks` object " \ + "instead! http://rubydoc.info/github/pry/pry/master/Pry/Hooks" + self["hooks"] = Pry::Hooks.from_hash(hooks) + else + self["hooks"] = hooks + end + end + def quiet? quiet end