diff options
author | Michael Bleigh <michael@intridea.com> | 2011-01-27 08:21:18 -0600 |
---|---|---|
committer | Michael Bleigh <michael@intridea.com> | 2011-01-27 08:21:18 -0600 |
commit | 7f16c83468bf3601fe2a81f6bbba08e810bdd1e6 (patch) | |
tree | c5ecce82e41b7a26f9f9c22de9119b221cdfc43c | |
parent | 7665f687d9e950996ce2e3cd0f9abd86d103777e (diff) | |
parent | 853f79aaafa3ec901b18e7ee18318bde61073b4f (diff) | |
download | hashie-7f16c83468bf3601fe2a81f6bbba08e810bdd1e6.tar.gz |
Merge branch 'master' of https://github.com/rainux/hashie
-rw-r--r-- | lib/hashie/mash.rb | 4 | ||||
-rw-r--r-- | spec/hashie/mash_spec.rb | 14 |
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 |