lib/multi_xml.rb
# 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.
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.
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 .
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|
        begin
          require library
          return parser
        rescue LoadError
          next
        end
      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
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 | begin require library return parser rescue LoadError next end 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
The default parser based on what you currently
have loaded and installed.
The default parser based on what you currently have loaded and installed .