Module: Mwc::Utils::Option::ClassMethods
- Defined in:
- lib/mwc/utils/option.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#cast(value, type) ⇒ Object
private
Cast value to specify type.
-
#option(name, options = {}) ⇒ Object
private
Define new options.
Instance Method Details
#cast(value, type) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Cast value to specify type
43 44 45 46 47 48 49 50 51 |
# File 'lib/mwc/utils/option.rb', line 43 def cast(value, type) return if value.nil? case type when :path then Mwc.root.join(value) when :bool then value == true else value end end |
#option(name, options = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Define new options
29 30 31 32 33 34 |
# File 'lib/mwc/utils/option.rb', line 29 def option(name, = {}) return create_array_option(name, ) if [:array] == true option_reader(name, ) option_writer(name, ) end |