summaryrefslogtreecommitdiff
path: root/lib/hashie/dash.rb
diff options
context:
space:
mode:
authordblock <dblock@dblock.org>2021-11-07 22:21:45 -0500
committerdblock <dblock@dblock.org>2021-11-07 22:21:45 -0500
commit25a3ff6e0498234d25de6a02bdbd3e508ade5898 (patch)
tree3ae1add7a8731daf46264b7a78cea9ac8b3278d0 /lib/hashie/dash.rb
parent796f9446fe3313685fe1a5c74052e1e942d170a2 (diff)
parent98df995e2f0433d3d1abe46efd732bc8e20e31cc (diff)
downloadhashie-25a3ff6e0498234d25de6a02bdbd3e508ade5898.tar.gz
Merge branch 'dash-nil-keys' of https://github.com/michaelherold/hashie into michaelherold-dash-nil-keys
Diffstat (limited to 'lib/hashie/dash.rb')
-rw-r--r--lib/hashie/dash.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/hashie/dash.rb b/lib/hashie/dash.rb
index 785d94d..cfb151e 100644
--- a/lib/hashie/dash.rb
+++ b/lib/hashie/dash.rb
@@ -156,6 +156,13 @@ module Hashie
self
end
+ def to_h
+ defaults = ::Hash[self.class.properties.map { |prop| [prop, self.class.defaults[prop]] }]
+
+ defaults.merge(self)
+ end
+ alias to_hash to_h
+
def update_attributes!(attributes)
update_attributes(attributes)