summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/hashie/mash.rb4
-rw-r--r--spec/hashie/mash_spec.rb14
2 files changed, 18 insertions, 0 deletions
diff --git a/lib/hashie/mash.rb b/lib/hashie/mash.rb
index 97af028..f3d90f1 100644
--- a/lib/hashie/mash.rb
+++ b/lib/hashie/mash.rb
@@ -85,6 +85,10 @@ module Hashie
regular_reader(ck)
end
+ def delete(key)
+ super(convert_key(key))
+ end
+
alias_method :regular_dup, :dup
# Duplicates the current mash as a new mash.
def dup
diff --git a/spec/hashie/mash_spec.rb b/spec/hashie/mash_spec.rb
index 5aa8818..eed1189 100644
--- a/spec/hashie/mash_spec.rb
+++ b/spec/hashie/mash_spec.rb
@@ -128,6 +128,20 @@ describe Hashie::Mash do
duped.details.email.should be_nil
end
end
+
+ describe 'delete' do
+ it 'should delete with String key' do
+ subject.delete('details')
+ subject.details.should be_nil
+ subject.should_not be_respond_to :details
+ end
+
+ it 'should delete with Symbol key' do
+ subject.delete(:details)
+ subject.details.should be_nil
+ subject.should_not be_respond_to :details
+ end
+ end
end
it "should convert hash assignments into Hashie::Mashes" do