Class: YAML_LD::Writer

Inherits:
JSON::LD::Writer
  • Object
show all
Defined in:
lib/yaml_ld/writer.rb

Overview

A YAML-LD serializer in Ruby.

Instance Method Summary collapse

Constructor Details

#initialize(output = $stdout, **options) {|writer| ... } ⇒ Writer

Initializes the YAML-LD writer instance.

Parameters:

  • output (IO, File) (defaults to: $stdout)

    the output stream

  • options (Hash{Symbol => Object})

    any additional options

Options Hash (**options):

  • :encoding (Encoding) — default: Encoding::UTF_8

    the encoding to use on the output stream (Ruby 1.9+)

  • :canonicalize (Boolean) — default: false

    whether to canonicalize literals when serializing

  • :prefixes (Hash) — default: {}

    the prefix mappings to use (not supported by all writers)

  • :standard_prefixes (Boolean) — default: false

    Add standard prefixes to @prefixes, if necessary.

  • :context (IO, Array, Hash, String, Context) — default: {}

    context to use when serializing. Constructed context for native serialization.

  • :frame (IO, Array, Hash, String, Context) — default: {}

    frame to use when serializing.

  • :unique_bnodes (Boolean) — default: false

    Use unique bnode identifiers, defaults to using the identifier which the node was originall initialized with (if any).

  • serializer (Proc) — default: YAML_LD::API.serializer

    A Serializer method used for generating the YAML serialization of the result.

  • :stream (Boolean) — default: false

    Do not attempt to optimize graph presentation, suitable for streaming large graphs.

Yields:

  • (writer)

    self

  • (writer)

Yield Parameters:

  • writer (RDF::Writer)
  • writer (RDF::Writer)

Yield Returns:

  • (void)


38
39
40
# File 'lib/yaml_ld/writer.rb', line 38

def initialize(output = $stdout, **options, &block)
  super(output, **options.merge(serializer: YAML_LD::API.method(:serializer)), &block)
end