Sha256: 78ef33bfe4aef0c179c02cef64917d28dd43fc2e4fb72b62f38d36a5b1f9bc93

Contents?: true

Size: 901 Bytes

Versions: 1

Compression:

Stored size: 901 Bytes

Contents

require 'saxon/loader'

module Saxon
  module S9API
    CLASS_IMPORT_SEMAPHORE = Mutex.new

    class << self
      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

1 entries across 1 versions & 1 rubygems

Version Path
saxon-rb-0.4.0-java lib/saxon/s9api.rb