1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
def jruby?
RUBY_PLATFORM == "java"
end
def windows?
Gem.win_platform?
end
# Returns the best available parser for the current platform
# ox and libxml are not available on Windows or JRuby
def best_available_parser
if windows? || jruby?
:nokogiri
else
:ox
end
end
# Returns an array of parser constants that are actually loaded
def loaded_parser_consts
%i[Ox LibXML Nokogiri Oga].select { |name| Object.const_defined?(name) }
end
require "multi_xml"
require "minitest/autorun"
require "minitest/mock"
|