intridea/hashie — pull request #34 by bradgessler (2012-02-12 23:36:18+00:00)
Title: Deferred defaults for Dash

Its desirable to have Procs that populate a default value for a key in Dash. For example, a key that generates a GUID and/or populates created_at may be wanted for an object:

class DeferredTest < Hashie::Dash
property :created_at, :default => Proc.new{ Time.now }
property :guid, :default => Proc.new{ rand(10000) } # Crappy GUID, I know...
end

This pull request adds support for lazily evaluated defaults to Dash to support this use case.