Method: ECG::Plugin::LoadOptionValues.prepended

Defined in:
lib/ecg/plugin/load_option_values.rb

.prepended(_mod) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/ecg/plugin/load_option_values.rb', line 13

def prepended(_mod)
  return if instance_variable_defined?(:@option_values)

  @option_values = {}
  parser = OptionParser.instance

  parser.on('-v', '--values Key=Value', <<~__DESC__) do |str|
    Set the key-value mapping to be embedded in the template.
  __DESC__

    @option_values.store(*str.split('=', 2))
  end
end