Class: YAML_LD::Reader

Inherits:
JSON::LD::Reader
  • Object
show all
Defined in:
lib/yaml_ld/reader.rb

Overview

A YAML-LD parser in Ruby.

Instance Method Summary collapse

Constructor Details

#initialize(input = $stdin, documentLoader: YAML_LD::API.method(:documentLoader), **options) {|reader| ... } ⇒ Reader

Initializes the YAML-LD reader instance.

Parameters:

  • input (IO, File, String) (defaults to: $stdin)
  • documentLoader (Proc) (defaults to: YAML_LD::API.method(:documentLoader))

    The callback of the loader to be used to retrieve remote documents and contexts, and to parse IO objects. If specified, it must be used to retrieve remote documents and contexts; otherwise, if not specified, the processor’s built-in loader must be used. The remote document returned must be parsed if it is YAML.

  • options (Hash{Symbol => Object})

    any additional options (see RDF::Reader#initialize and JSON::LD::API.initialize)

Yields:

  • (reader)

    self

Yield Parameters:

  • reader (RDF::Reader)

Yield Returns:

  • (void)

    ignored

Raises:

  • (RDF::ReaderError)

    if the JSON document cannot be loaded



24
25
26
27
28
29
# File 'lib/yaml_ld/reader.rb', line 24

def initialize(input = $stdin,
  documentLoader: YAML_LD::API.method(:documentLoader),
  **options, &block)
  input = StringIO.new(input) if input.is_a?(String)
  super(input, documentLoader: documentLoader, **options, &block)
end