Release 2.0.1
Changes for Framing:
- Add support for
@reversein frames. - Add
framingandkeep_free_floating_nodesoption to expand and use when expanding frame.
Support for pre-loaded contexts
In many cases, for small documents, processing time can be dominated by loading and parsing remote contexts. In particular, a small schema.org example may need to download a large context and turn it into an internal representation, before the actual document can be expanded for processing. Using JSON::LD::Context.add_preloaded, an implementation can perform this loading up-front, and make it available to the processor.
ctx = JSON::LD::Context.new().parse('http://schema.org/')
JSON::LD::Context.add_preloaded('http://schema.org/', ctx)
On lookup, URIs with an https prefix are normalized to http.
A context may be serialized to Ruby to speed this process using Context#to_rb. When loaded, this generated file will add entries to the JSON::LD::Context::PRELOADED.
Use json-ld-preloaded gem to have popular contexts preloaded (note, this freezes these contexts at the time the gem is built).
- Add
Context::PRELOADED, andContext.add_preloaded. When parsing an otherwise loaded context, if it exists inPRELOADED, use that instead of remotely loading it. Avoids potentially expensive context parsing for common cases. - Generate lazy-loaded Ruby for defining a context from a loaded context. Initializes
Context::PRELOADEDfor the context base.
General
- Remove a lot of expensive debugging statements.
- Use frozen string literals
- Minimum Ruby version 2.2.2.