Sha256: 1f382318dcbe5f42d3dd9d974a270f4f9880b7b66ce44a7501b97e8972386c27
Contents?: true
Size: 1.16 KB
Versions: 6
Compression:
Stored size: 1.16 KB
Contents
require 'saxon/loader' module Saxon module S9API CLASS_IMPORT_SEMAPHORE = Mutex.new private_constant :CLASS_IMPORT_SEMAPHORE class << self # Override the +const_missing+ hook in {S9API} so that we can delay # loading the Saxon JARs until the user has had a chance to set an # alternate location for them, if they don't want to use the bundled Saxon # HE def const_missing(name) Saxon::Loader.load! begin const_set(name, imported_classes.const_get(name)) rescue NameError msg = "uninitialized constant Saxon::S9API::#{name}" e = NameError.new(msg, name) raise e end end private def imported_classes return @imported_classes if instance_variable_defined?(:@imported_classes) CLASS_IMPORT_SEMAPHORE.synchronize do @imported_classes = Module.new { include_package 'net.sf.saxon.s9api' java_import Java::net.sf.saxon.Configuration java_import Java::net.sf.saxon.lib.FeatureKeys java_import Java::net.sf.saxon.lib.ParseOptions } end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems