module

Ktistec::JSON_LD

Constants

KEYWORDS = ["@context", "@id", "@type", "@value", "@language"]

JSON-LD keywords that expansion acts on. Every other keyword (@graph, @included, @reverse, @list, @nest, …) is dropped and logged, rather than passed through unexpanded where no consumer reads it.

Log = ::Log.for(self)

Class methods

dig?(json : JSON::Any, *selector, as : T.class = String) forall T

Digs out the first member of a set, cast to the given type.

See dig_first? for the set-collapse behavior.

Source
dig_first?(json : JSON::Any, *selector) : JSON::Any | Nil

Digs out the first member of a set.

Expansion normalizes every property value to a set; a consumer that wants one value takes the first member of a non-empty set at each level of the selector (an empty set yields nil).

Source
dig_id?(json, *selector)
Source
dig_ids?(json, *selector)
Source
dig_time?(json : JSON::Any, *selector) : Time | Nil

Digs out the first member of a set and parses it as a timestamp.

See dig_first? for the set-collapse behavior and parse_time? for the accepted formats.

Source
dig_values?(json, *selector, &)
Source
expand(body : JSON::Any | String | IO, loader = Loader.new)

Expands the JSON-LD document.

Source
parse_time?(value : String) : Time | Nil

Parses a timestamp.

AS2 Core §2.3 requires RFC 3339, relaxed to let seconds be omitted, and requires a time-offset. Time.parse_rfc3339 implements RFC 3339 exactly, so it rejects both the conformant timestamps AS2 permits (seconds omitted) and the non-conformant ones peers emit -- notably an ISO 8601 basic-format offset (+0000 rather than +00:00).

Returns nil when the value can't be parsed.

Source

Nested types