Sha256: 3a0d20a5e7d3aafcd76557b53c42bffb464b1b23a4e789dce761adeef555bb08
Contents?: true
Size: 1.13 KB
Versions: 4
Compression:
Stored size: 1.13 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) CLASS_IMPORT_SEMAPHORE.synchronize { return const_get(name) if const_defined?(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 @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
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
saxon-rb-0.8.3-java | lib/saxon/s9api.rb |
saxon-rb-0.8.2-java | lib/saxon/s9api.rb |
saxon-rb-0.8.1-java | lib/saxon/s9api.rb |
saxon-rb-0.8.0-java | lib/saxon/s9api.rb |