class UserChoices::XmlConfigFileSource

Use an XML file as a source of choices. The XML file is parsed with XmlSimple('ForceArray' => false). That means that single elements like <home>Mars</home> are read as the value "Mars", whereas <home>Mars</home><home>Venus</home> is read as ["Mars", "Venus"].

Public Instance Methods

format_specific_exception?(ex) click to toggle source
# File lib/user-choices/sources.rb, line 217
def format_specific_exception?(ex)
  ex.is_a?(REXML::ParseException)
end
format_specific_message(ex) click to toggle source
# File lib/user-choices/sources.rb, line 221
def format_specific_message(ex)
  ex.continued_exception
end
format_specific_reading() click to toggle source

Treat filename as the configuration file. filename is expected to be in the home directory. The home directory is found in the same way Rubygems finds it. (First look in environment variables $HOME, $USERPROFILE, $HOMEDRIVE:$HOMEPATH, file expansion of "~" and finally the root.)

# File lib/user-choices/sources.rb, line 213
def format_specific_reading
  XmlSimple.xml_in(@path, 'ForceArray' => false)
end