From 76d4f03934de39d85133510cf85dfa5a2eeff0e5 Mon Sep 17 00:00:00 2001 From: Robert Gleeson Date: Sun, 2 Feb 2014 23:23:23 +0100 Subject: [PATCH] add Behavior#keys. --- lib/pry/config/behavior.rb | 4 ++++ spec/config_spec.rb | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/lib/pry/config/behavior.rb b/lib/pry/config/behavior.rb index 29eea187..d72d7afa 100644 --- a/lib/pry/config/behavior.rb +++ b/lib/pry/config/behavior.rb @@ -91,6 +91,10 @@ module Pry::Config::Behavior end alias_method :eql?, :== + def keys + @writes.keys + end + def to_hash @writes.dup end diff --git a/spec/config_spec.rb b/spec/config_spec.rb index bfbaaa89..aa38a1bc 100644 --- a/spec/config_spec.rb +++ b/spec/config_spec.rb @@ -51,6 +51,14 @@ describe Pry::Config do end + describe "#keys" do + it "returns an array of local keys" do + root = Pry::Config.from_hash({zoo: "boo"}, nil) + local = Pry::Config.from_hash({foo: "bar"}, root) + local.keys.should == ["foo"] + end + end + describe "#==" do it "compares equality through the underlying lookup table" do local1 = Pry::Config.new(nil)