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
15 16 17 18 19 20 |
# File 'lib/eco-rake/option/default_lookup.rb', line 15 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
24 25 26 27 28 29 30 |
# File 'lib/eco-rake/option/default_lookup.rb', line 24 def type_coercion return @type_coercion if @type_coercion return nil unless default? value = default return nil if value.nil? value.class end |