summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/hashie/extensions/indifferent_access.rb1
-rw-r--r--spec/hashie/extensions/indifferent_access_spec.rb10
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/hashie/extensions/indifferent_access.rb b/lib/hashie/extensions/indifferent_access.rb
index 13218a9..1e15e95 100644
--- a/lib/hashie/extensions/indifferent_access.rb
+++ b/lib/hashie/extensions/indifferent_access.rb
@@ -27,6 +27,7 @@ module Hashie
base.class_eval do
alias_method :regular_writer, :[]=
alias_method :[]=, :indifferent_writer
+ alias_method :store, :indifferent_writer
%w(default update replace fetch delete key? values_at).each do |m|
alias_method "regular_#{m}", m
alias_method m, "indifferent_#{m}"
diff --git a/spec/hashie/extensions/indifferent_access_spec.rb b/spec/hashie/extensions/indifferent_access_spec.rb
index d0522fc..a03a604 100644
--- a/spec/hashie/extensions/indifferent_access_spec.rb
+++ b/spec/hashie/extensions/indifferent_access_spec.rb
@@ -13,6 +13,16 @@ describe Hashie::Extensions::IndifferentAccess do
h['abc'].should == 123
end
+
+ describe '#store' do
+ it 'should indifferently save values' do
+ h = subject.new
+ h.store(:abc, 123)
+ h[:abc].should == 123
+ h['abc'].should == 123
+ end
+ end
+
describe '#values_at' do
it 'should indifferently find values' do
h = subject.new(:foo => 'bar', 'baz' => 'qux')