Class: Saxon::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/saxon/configuration.rb

Overview

Wraps the net.saxon.Configuration class. See saxonica.com/documentation9.5/javadoc/net/sf/saxon/Configuration.html for details of what configuration options are available and what values they accept. See saxonica.com/documentation9.5/javadoc/net/sf/saxon/lib/FeatureKeys.html for details of the constant names used to access the values

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Configuration

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Configuration.

Parameters:

  • config (net.sf.saxon.Configuration)

    The Saxon Configuration instance to wrap



23
24
25
# File 'lib/saxon/configuration.rb', line 23

def initialize(config)
  @config = config
end

Class Method Details

.create(processor = nil) ⇒ Saxon::Configuration

Parameters:

  • processor (Saxon::Processor) (defaults to: nil)

    a Saxon::Processor instance

Returns:



11
12
13
14
15
16
17
18
# File 'lib/saxon/configuration.rb', line 11

def self.create(processor = nil)
  if processor
    config = processor.to_java.underlying_configuration
  else
    config = Saxon::S9API::Configuration.new
  end
  new(config)
end

Instance Method Details

#[](option) ⇒ Object

Get a configuration option value See saxonica.com/documentation9.5/javadoc/net/sf/saxon/lib/FeatureKeys.html for details of the available options. Use the constant name as a string or symbol as the option

Parameters:

  • option (String, Symbol)

Returns:

  • (Object)

    the value of the configuration option

Raises:

  • (NameError)

    if the option name does not exist



35
36
37
# File 'lib/saxon/configuration.rb', line 35

def [](option)
  @config.getConfigurationProperty(option_url(option))
end

#[]=(option, value) ⇒ Object

Get a configuration option value See saxonica.com/documentation9.5/javadoc/net/sf/saxon/lib/FeatureKeys.html for details of the available options. Use the constant name as a string or symbol as the option

Parameters:

  • option (String, Symbol)
  • value (Object)

    the value of the configuration option

Returns:

  • (Object)

    the value you passed in

Raises:

  • (NameError)

    if the option name does not exist



48
49
50
# File 'lib/saxon/configuration.rb', line 48

def []=(option, value)
  @config.setConfigurationProperty(option_url(option), value)
end

#to_javanet.sf.saxon.Configuration

Returns The underlying Saxon Configuration.

Returns:

  • (net.sf.saxon.Configuration)

    The underlying Saxon Configuration



53
54
55
# File 'lib/saxon/configuration.rb', line 53

def to_java
  @config
end