Class: YAML_LD::Format

Inherits:
RDF::Format
  • Object
show all
Defined in:
lib/yaml_ld/format.rb

Overview

YAML-LD format specification.

Examples:

Obtaining an YAML-LD format class

RDF::Format.for(:YAML_LD)           #=> YAML_LD::Format
RDF::Format.for("etc/foaf.YAML_LD")
RDF::Format.for(:file_name         => "etc/foaf.YAML_LD")
RDF::Format.for(file_extension: "YAML_LD")
RDF::Format.for(:content_type   => "application/ld+yaml")

Obtaining serialization format MIME types

RDF::Format.content_types      #=> {"application/ld+yaml" => [YAML_LD::Format],

Obtaining serialization format file extension mappings

RDF::Format.file_extensions    #=> {:YAML_LD => [YAML_LD::Format] }

See Also:

Class Method Summary collapse

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.

Parameters:

  • sample (String)

    Beginning several bytes (~ 1K) of input.

Returns:

  • (Boolean)


40
41
42
# File 'lib/yaml_ld/format.rb', line 40

def self.detect(sample)
  !!sample.match(/---/m)
end

.nameObject

Override normal format name



52
53
54
# File 'lib/yaml_ld/format.rb', line 52

def self.name
  "YAML-LD"
end

.to_symObject

Override normal symbol generation



46
47
48
# File 'lib/yaml_ld/format.rb', line 46

def self.to_sym
  :yamlld
end