class HexaPDF::Configuration


Manages both the global and document specific configuration options for HexaPDF.


HexaPDF allows detailed control over many aspects of PDF manipulation. If there is a need to use a certain default value somewhere, it is defined as a configuration option so that it can easily be changed.

Some options are defined as global options because they are needed on the class level - see HexaPDF::GlobalConfiguration. Other options can be configured for individual documents as they allow to fine-tune some behavior - see HexaPDF::DefaultDocumentConfiguration.

A configuration option name is dot-separted to provide a hierarchy of option names. For example, io.chunk_size.



Returns the hash with the configuration options.

Public Class Methods

new(options = {})

Creates a new Configuration object using the provided hash argument.

with_defaults(values = {})

Creates a new document specific Configuration object by merging the values into the default configuration object.

Public Instance Methods


Returns the value for the configuration option name.

[]=(name, value)

Uses value as the value for the configuration option name.

constantize(name, *keys) → constant
constantize(name, *keys) {|name| block} → obj

Returns the constant the option name is referring to. If keys are provided and the value of the option name responds to #dig, the constant to which the keys refer is returned.

If no constant can be found and no block is provided, an error is raised. If a block is provided it is called with the option name and its result will be returned.

config.constantize('encryption.aes')      #=> HexaPDF::Encryption::FastAES
config.constantize('', :Fl)     #=> HexaPDF::Filter::FlateDecode

Returns true if the given option exists.

Also aliased as: option?

Returns a new Configuration object containing the options from the given configuration object (or hash) and this configuration object.

If a key already has a value in this object, its value is overwritten by the one from config. However, hash values are merged instead of being overwritten. Array values are duplicated.

Alias for: key?