Class: ArticleFixtureGen::Exe::Trollop::OptionsWithDefaults
- Inherits:
-
Object
- Object
- ArticleFixtureGen::Exe::Trollop::OptionsWithDefaults
- Defined in:
- lib/article_fixture_gen/exe/option_parser/trollop/options_with_defaults.rb
Overview
Builds an encapsulation of Trollop option menu and default values.
Class Method Summary collapse
-
.call(all_specs) ⇒ Object
Reek says this method has :reek:TooManyStatements.
Class Method Details
.call(all_specs) ⇒ Object
Reek says this method has :reek:TooManyStatements. Such is a DSL.
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/article_fixture_gen/exe/option_parser/trollop/options_with_defaults.rb', line 23 def self.call(all_specs) defaults = {} = ::Trollop. do version VERSION_BANNER USAGE_BANNER all_specs.map { |spec| spec.add_option self } # Reminder: `all_specs` is our data. `Trollop.specs` is valid only # inside the `.options` block specs.each { |attrib, spec| defaults[attrib] = spec[:default] } end Result.new defaults: defaults, options: end |