Module: Disposable::Twin::Default
- Defined in:
- lib/disposable/twin/default.rb
Overview
TODO: allow default: -> for hashes, etc.
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(includer) ⇒ Object
23 24 25 |
# File 'lib/disposable/twin/default.rb', line 23 def self.included(includer) includer.extend ClassMethods end |
Instance Method Details
#default_for(dfn, options) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/disposable/twin/default.rb', line 9 def default_for(dfn, ) # 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 |
#setup_value_for(dfn, options) ⇒ Object
3 4 5 6 7 |
# File 'lib/disposable/twin/default.rb', line 3 def setup_value_for(dfn, ) value = super return value unless value.nil? default_for(dfn, ) end |