Class: ArticleFixtureGen::Exe::Trollop::OptionSpec

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/article_fixture_gen/exe/option_parser/trollop/option_spec.rb

Overview

Encapsulate configuration of a Trollop command-line option

Instance Method Summary collapse

Constructor Details

#initialize(*key_and_desc, **options) ⇒ OptionSpec

Returns a new instance of OptionSpec.



14
15
16
17
18
19
20
# File 'lib/article_fixture_gen/exe/option_parser/trollop/option_spec.rb', line 14

def initialize(*key_and_desc, **options)
  @item = OptionSpecItem.new key: key_and_desc[0],
                             desc: key_and_desc[1], options: options
  # freeze # Cannot freeze data passed to `Trollop.opt`.
  #          WTFometer at 11.
  self
end

Instance Method Details

#add_option(context) ⇒ Object



22
23
24
# File 'lib/article_fixture_gen/exe/option_parser/trollop/option_spec.rb', line 22

def add_option(context)
  context.opt key, desc, options
end