Method: MultiXml.default_parser
- Defined in:
- lib/multi_xml.rb
permalink .default_parser ⇒ Object
The default parser based on what you currently have loaded and installed. First checks to see if any parsers are already loaded, then checks to see which are installed if none are loaded.
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/multi_xml.rb', line 89 def default_parser return :ox if defined?(::Ox) return :libxml if defined?(::LibXML) return :nokogiri if defined?(::Nokogiri) return :oga if defined?(::Oga) REQUIREMENT_MAP.each do |library, parser| require library return parser rescue LoadError next end raise(NoParserError, "No XML parser detected. If you're using Rubinius and Bundler, try adding an XML parser to your Gemfile (e.g. libxml-ruby, nokogiri, or rubysl-rexml). For more information, see https://github.com/sferik/multi_xml/issues/42.") end |