summaryrefslogtreecommitdiff
path: root/lib/hashie/dash.rb
diff options
context:
space:
mode:
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)