lib/hashr.rb in hashr-0.0.15 vs lib/hashr.rb in hashr-0.0.16
- old
+ new
@@ -75,9 +75,16 @@
def meta_class
class << self; self end
end
+ def to_hash
+ inject({}) do |hash, (key, value)|
+ hash[key] = value.is_a?(Hashr) ? value.to_hash : value
+ hash
+ end
+ end
+
protected
def deep_hashrize(hash)
hash.inject(TEMPLATE.dup) do |result, (key, value)|
case key.to_sym