summaryrefslogtreecommitdiff
path: root/lib/hashie/extensions/dash/indifferent_access.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/hashie/extensions/dash/indifferent_access.rb')
-rw-r--r--lib/hashie/extensions/dash/indifferent_access.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/hashie/extensions/dash/indifferent_access.rb b/lib/hashie/extensions/dash/indifferent_access.rb
index 204cae6..50d4f93 100644
--- a/lib/hashie/extensions/dash/indifferent_access.rb
+++ b/lib/hashie/extensions/dash/indifferent_access.rb
@@ -19,6 +19,15 @@ module Hashie
end
private_class_method :requires_class_methods?
+ def to_h
+ defaults = ::Hash[self.class.properties.map do |prop|
+ [Hashie::Extensions::IndifferentAccess.convert_key(prop), self.class.defaults[prop]]
+ end]
+
+ defaults.merge(self)
+ end
+ alias to_hash to_h
+
module ClassMethods
# Check to see if the specified property has already been
# defined.