Module: Saxon::S9API

Defined in:
lib/saxon/loader.rb,
lib/saxon/s9api.rb

Overview

A sensible namespace to put Saxon Java classes into

Class Method Summary collapse

Class Method Details

.const_missing(name) ⇒ Object

Override the const_missing hook in Saxon::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



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/saxon/s9api.rb', line 13

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