Class: YAML_LD::Writer

Inherits:
JSON::LD::Writer show all
Defined in:
vendor/bundler/ruby/3.3.0/bundler/gems/yaml-ld-d851238cc6dc/lib/yaml_ld/writer.rb

Overview

A YAML-LD serializer in Ruby.

Constant Summary

Constants included from RDF::Util::Logger

RDF::Util::Logger::IOWrapper

Instance Attribute Summary

Attributes inherited from JSON::LD::Writer

#context, #graph

Attributes inherited from RDF::Writer

#options

Instance Method Summary collapse

Methods inherited from JSON::LD::Writer

accept?, options, #write_epilogue, #write_prologue, #write_quad, #write_triple

Methods included from RDF::Util::Logger

#log_debug, #log_depth, #log_error, #log_fatal, #log_info, #log_recover, #log_recovering?, #log_statistics, #log_warn, #logger

Methods included from JSON::LD::Utils

#add_value, #as_array, #as_resource, #blank_node?, #compare_values, #graph?, #has_value?, #index?, #list?, #node?, #node_or_ref?, #node_reference?, #property?, #simple_graph?, #value?

Methods included from JSON::LD::StreamingWriter

#stream_epilogue, #stream_prologue, #stream_statement

Methods inherited from RDF::Writer

accept?, #base_uri, buffer, #canonicalize?, dump, each, #encoding, #escaped, #flush, for, format, #format_list, #format_literal, #format_node, #format_quotedTriple, #format_term, #format_tripleTerm, #format_uri, #node_id, open, options, #prefix, #prefixes, #prefixes=, #puts, #quoted, to_sym, #to_sym, #uri_for, #validate?, #write_comment, #write_epilogue, #write_prologue, #write_statement, #write_triple, #write_triples

Methods included from RDF::Util::Aliasing::LateBound

#alias_method

Methods included from RDF::Writable

#<<, #insert, #insert_graph, #insert_reader, #insert_statement, #insert_statements, #writable?

Methods included from RDF::Util::Coercions

#coerce_statements

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:

Yield Returns:

  • (void)


38
39
40
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/yaml-ld-d851238cc6dc/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