From 0ad3473ebbb79304c02d990a34e7dda468d55f48 Mon Sep 17 00:00:00 2001 From: William Vu Date: Tue, 24 Feb 2015 20:47:00 -0600 Subject: [PATCH 1/2] Implement case-insensitive datastore.delete --- lib/msf/core/data_store.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/msf/core/data_store.rb b/lib/msf/core/data_store.rb index 5ffbf81bce..f234e486f7 100644 --- a/lib/msf/core/data_store.rb +++ b/lib/msf/core/data_store.rb @@ -43,6 +43,13 @@ class DataStore < Hash super(find_key_case(k), v) end + # + # Case-insensitive wrapper around delete + # + def delete(k) + super(find_key_case(k)) + end + # # Updates a value in the datastore with the specified name, k, to the From 2a66a6ae88a7670177b97b1d4a66096f02a1a1d2 Mon Sep 17 00:00:00 2001 From: William Vu Date: Tue, 24 Feb 2015 20:57:38 -0600 Subject: [PATCH 2/2] Add delete to datastore spec --- spec/lib/msf/core/data_store_spec.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/spec/lib/msf/core/data_store_spec.rb b/spec/lib/msf/core/data_store_spec.rb index e55d3154ee..97421714ca 100644 --- a/spec/lib/msf/core/data_store_spec.rb +++ b/spec/lib/msf/core/data_store_spec.rb @@ -24,6 +24,11 @@ shared_examples "datastore" do subject.to_h.should == { "foo" => "bar", "fizz" => "buzz" } end end + context "#delete" do + it "should delete the specified key" do + subject.delete("foo") == { "fizz" => "buzz" } + end + end end describe Msf::DataStore do