class ArticleFixtureGen::Exe::Trollop::OptionsWithDefaults
Builds an encapsulation of Trollop
option menu and default values.
Constants
- USAGE_BANNER
- VERSION_BANNER
Public Class Methods
call(all_specs)
click to toggle source
Reek says this method has :reek:TooManyStatements. Such is a DSL.
# File lib/article_fixture_gen/exe/option_parser/trollop/options_with_defaults.rb, line 23 def self.call(all_specs) defaults = {} options = ::Trollop.options do version VERSION_BANNER 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: options end