Class: YAML_LD::Reader

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

Overview

A YAML-LD parser in Ruby.

Constant Summary

Constants included from RDF::Util::Logger

RDF::Util::Logger::IOWrapper

Instance Attribute Summary

Attributes included from JSON::LD::StreamingReader

#base, #namer

Attributes inherited from RDF::Reader

#options

Attributes included from RDF::Enumerable

#existentials, #universals

Instance Method Summary collapse

Methods inherited from JSON::LD::Reader

options

Methods included from JSON::LD::StreamingReader

format, #stream_statement

Methods included from JSON::LD::ToRDF

#item_to_rdf, #node, #parse_list

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 inherited from RDF::Reader

#base_uri, #canonicalize?, #close, each, #each_pg_statement, #each_triple, #encoding, #fail_object, #fail_predicate, #fail_subject, for, format, #intern?, #lineno, open, options, #prefix, #prefixes, #prefixes=, #read_statement, #read_triple, #rewind, to_sym, #to_sym, #valid?, #validate?

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

#alias_method

Methods included from RDF::Enumerable

add_entailment, #canonicalize, #canonicalize!, #dump, #each_graph, #each_object, #each_predicate, #each_quad, #each_subject, #each_term, #each_triple, #entail, #enum_graph, #enum_object, #enum_predicate, #enum_quad, #enum_statement, #enum_subject, #enum_term, #enum_triple, #graph?, #graph_names, #invalid?, #method_missing, #object?, #objects, #predicate?, #predicates, #project_graph, #quad?, #quads, #respond_to_missing?, #statement?, #statements, #subject?, #subjects, #supports?, #term?, #terms, #to_a, #to_h, #to_set, #triple?, #triples, #valid?, #validate!

Methods included from RDF::Isomorphic

#bijection_to, #isomorphic_with?

Methods included from RDF::Countable

#count, #empty?

Methods included from RDF::Readable

#readable?

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

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:

Yield Returns:

  • (void)

    ignored

Raises:



24
25
26
27
28
29
30
31
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/yaml-ld-d851238cc6dc/lib/yaml_ld/reader.rb', line 24

def initialize(input = $stdin,
  documentLoader: YAML_LD::API.method(:documentLoader),
  **options, &block)
  input = StringIO.new(input).tap do |d|
    d.define_singleton_method(:content_type) {'application/ld+yaml'}
  end if input.is_a?(String)
  super(input, documentLoader: documentLoader, **options, &block)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class RDF::Enumerable