Module: EcoRake::Option::DefaultLookup
- Included in:
- EcoRake::Option
- Defined in:
- lib/eco-rake/option/default_lookup.rb
Overview
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)
Instance Method Summary collapse
-
#default(&block) ⇒ Object
Default may be a lookup.
- #type_coercion ⇒ Class, NilClass
Instance Method Details
#default(&block) ⇒ Object
Default may be a lookup
16 17 18 19 20 21 22 |
# File 'lib/eco-rake/option/default_lookup.rb', line 16 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 |
#type_coercion ⇒ Class, NilClass
TODO:
link to default resolver, but indirectly
26 27 28 29 30 31 32 33 34 |
# File 'lib/eco-rake/option/default_lookup.rb', line 26 def type_coercion return @type_coercion if @type_coercion return unless default? value = default return if value.nil? value.class end |