module Disposable::Twin::Default
TODO: allow default: -> for hashes, etc.
Public Class Methods
included(includer)
click to toggle source
# File lib/disposable/twin/default.rb, line 26 def self.included(includer) includer.extend ClassMethods end
Public Instance Methods
default_for(dfn, options)
click to toggle source
# File lib/disposable/twin/default.rb, line 11 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].(exec_context: self) # Representable::Option#call end
setup_value_for(dfn, options)
click to toggle source
Calls superclass method
# File lib/disposable/twin/default.rb, line 5 def setup_value_for(dfn, options) value = super return value unless value.nil? default_for(dfn, options) end