Module: Anyway::OptparseConfig
- Included in:
- Config
- Defined in:
- lib/anyway/optparse_config.rb
Overview
Adds ability to use script options as the source of configuration (via optparse)
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
88 89 90 |
# File 'lib/anyway/optparse_config.rb', line 88 def self.included(base) base.extend ClassMethods end |
Instance Method Details
#option_parser ⇒ Object
72 73 74 75 76 77 78 79 80 |
# File 'lib/anyway/optparse_config.rb', line 72 def option_parser @option_parser ||= OptionParserBuilder.call(self.class.) do |key, val| write_config_attr(key, val) end.tap do |parser| self.class.option_parser_extensions.map do |extension| extension.call(parser, self) end end end |
#parse_options!(options) ⇒ Object
82 83 84 85 86 |
# File 'lib/anyway/optparse_config.rb', line 82 def () Tracing.with_trace_source(type: :options) do option_parser.parse!() end end |