private Method

XmlSimple.normalize_option_names(options, known_options)

Normalizes option names in a hash, i.e., turns all characters to lower case and removes all underscores. Additionally, this method checks, if an unknown option was used and raises an according exception.

options:Hash to be normalized.
known_options:List of known options.

Source Code

# File active_support/vendor/xml-simple-1.0.11/xmlsimple.rb, line 298
def normalize_option_names(options, known_options)
  return nil if options.nil?
  result = Hash.new
  options.each { |key, value|
    lkey = key.downcase
    lkey.gsub!(/_/, '')
    if !known_options.member?(lkey)
      raise ArgumentError, "Unrecognised option: #{lkey}."
    end
    result[lkey] = value
  }
  result
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.