Class: YAML_LD::Format
- Inherits:
-
RDF::Format
- Object
- RDF::Format
- YAML_LD::Format
- Defined in:
- vendor/bundler/ruby/3.3.0/bundler/gems/yaml-ld-2d2ba8e32d66/lib/yaml_ld/format.rb
Overview
YAML-LD format specification.
Constant Summary collapse
- LD_FORMATS =
Specify how to execute CLI commands for each supported format. These are added to the
LD_FORMATS
defined forJSON::LD::Format
Derived formats (e.g., YAML-LD) define their own entrypoints. { yamlld: { expand: ->(input, **) { YAML_LD::API.(input, validate: false, **) }, compact: ->(input, **) { YAML_LD::API.compact(input, [:context], **) }, flatten: ->(input, **) { YAML_LD::API.flatten(input, [:context], **) }, frame: ->(input, **) { YAML_LD::API.frame(input, [:frame], **) }, } }
Class Method Summary collapse
-
.detect(sample) ⇒ Boolean
Sample detection to see if it matches YAML-LD.
-
.name ⇒ Object
Override normal format name.
-
.to_sym ⇒ Object
Override normal symbol generation.
Methods inherited from RDF::Format
accept_type, accept_types, cli_commands, content_encoding, content_type, content_types, each, file_extension, file_extensions, for, reader, reader_symbols, reader_types, require, symbols, uri, uris, writer, writer_symbols, writer_types
Class Method Details
.detect(sample) ⇒ Boolean
Sample detection to see if it matches YAML-LD
Use a text sample to detect the format of an input file. Sub-classes implement a matcher sufficient to detect probably format matches, including disambiguating between other similar formats.
61 62 63 |
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/yaml-ld-2d2ba8e32d66/lib/yaml_ld/format.rb', line 61 def self.detect(sample) !!sample.match(/---/m) end |
.name ⇒ Object
Override normal format name
73 74 75 |
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/yaml-ld-2d2ba8e32d66/lib/yaml_ld/format.rb', line 73 def self.name "YAML-LD" end |
.to_sym ⇒ Object
Override normal symbol generation
67 68 69 |
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/yaml-ld-2d2ba8e32d66/lib/yaml_ld/format.rb', line 67 def self.to_sym :yamlld end |