Class: Saxon::Serializer::Destination

Inherits:
Object
  • Object
show all
Includes:
OutputProperties
Defined in:
lib/saxon/serializer/destination.rb

Overview

A Saxon Serializer to be used as a Destination for a transformation rather than being directly called with existing XDM objects

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from OutputProperties

#output_property

Constructor Details

#initialize(s9_serializer, invocation_lambda, &block) ⇒ Destination

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 Destination.



14
15
16
17
18
19
# File 'lib/saxon/serializer/destination.rb', line 14

def initialize(s9_serializer, invocation_lambda, &block)
  @s9_serializer, @invocation_lambda = s9_serializer, invocation_lambda
  if block_given?
    instance_exec(&block)
  end
end

Instance Attribute Details

#invocation_lambdaObject (readonly)

Returns the value of attribute invocation_lambda.



11
12
13
# File 'lib/saxon/serializer/destination.rb', line 11

def invocation_lambda
  @invocation_lambda
end

#s9_serializerObject (readonly)

Returns the value of attribute s9_serializer.



11
12
13
# File 'lib/saxon/serializer/destination.rb', line 11

def s9_serializer
  @s9_serializer
end

Instance Method Details

#serialize(io) ⇒ nil #serialize(path) ⇒ nil #serializeString

Overloads:

  • #serialize(io) ⇒ nil

    Serialize the transformation to an IO

    Parameters:

    • io (File, IO)

      The IO to serialize to

    Returns:

    • (nil)
  • #serialize(path) ⇒ nil

    Serialize the transformation to file path

    Parameters:

    • path (String, Pathname)

      The path of the file to serialize to

    Returns:

    • (nil)
  • #serializeString

    Serialize the transformation to a String

    Returns:

    • (String)

      The serialized XdmValue



32
33
34
35
36
37
38
39
40
41
# File 'lib/saxon/serializer/destination.rb', line 32

def serialize(io_or_path = nil)
  case io_or_path
  when nil
    serialize_to_string
  when String, Pathname
    serialize_to_file(io_or_path)
  else
    serialize_to_io(io_or_path)
  end
end

#to_javaSaxon::S9API::Serializer

Returns The underlying Saxon Serializer object.

Returns:

  • (Saxon::S9API::Serializer)

    The underlying Saxon Serializer object



44
45
46
# File 'lib/saxon/serializer/destination.rb', line 44

def to_java
  s9_serializer
end