Sha256: 3d656d292c9cd904cd2fb2163fd6d1ad83815d112431d7c1f561bf8bcec2acc2
Contents?: true
Size: 722 Bytes
Versions: 9
Compression:
Stored size: 722 Bytes
Contents
# TODO: allow default: -> for hashes, etc. module Disposable::Twin::Default def setup_value_for(dfn, options) value = super return value unless value.nil? default_for(dfn, options) end def default_for(dfn, options) # TODO: introduce Null object in Declarative::Definition#[]. # dfn[:default].(self) # dfn#[] should return a Null object here if empty. return unless dfn[:default] dfn[:default].evaluate(self) # TODO: use .() end module ClassMethods def property(name, options={}, &block) options[:default] = Uber::Options::Value.new(options[:default]) if options[:default] super end end def self.included(includer) includer.extend ClassMethods end end
Version data entries
9 entries across 9 versions & 1 rubygems