Sha256: 29905330719124cf671d03c5a39b133c4cb075af2a68fbe2f1ff0102a57758a5
Contents?: true
Size: 1.12 KB
Versions: 14
Compression:
Stored size: 1.12 KB
Contents
class EcoRake class Option # To prevent dependencies, it should resolve via parent, where parent # doesn't get new methods installed on the fly, but where the parent # does have the final result (method or const) module DefaultLookup class << self def included(base) super(base) base.extend EcoRake::Base::SymbolResolver end end # Default may be a lookup def default(&block) return @default unless default_lookup? result = self.class.safe_call(@default, parent, &block) result = self.class.safe_call(result, &block) if [Proc, Method].any? {|k| result.is_a?(k)} result end # @todo link to default resolver, but indirectly # @return [Class, NilClass] def type_coercion return @type_coercion if @type_coercion return nil unless default? value = default return nil if value.nil? value.class end protected def default_lookup? @default.is_a?(Proc) || @default.is_a?(Method) end end end end
Version data entries
14 entries across 14 versions & 1 rubygems