Method: Beaker::Options::Parser#tag_sources

Defined in:
lib/beaker/options/parser.rb

#tag_sources(options_hash, source) ⇒ Hash

Update the @attribution hash with the source of each key in the options_hash

Parameters:

  • options_hash (Hash)

    Options hash

  • source (String)

    Where the options were specified

Returns:

  • (Hash)

    hash Hash of sources for each key



177
178
179
180
181
182
183
184
185
186
187
# File 'lib/beaker/options/parser.rb', line 177

def tag_sources(options_hash, source)
  hash = Beaker::Options::OptionsHash.new
  options_hash.each do |key, value|
    if value.is_a?(Hash)
      hash[key] = tag_sources(value, source)
    else
      hash[key] = source
    end
  end
  hash
end