lib/ro_crate/model/metadata.rb in ro-crate-0.4.10 vs lib/ro_crate/model/metadata.rb in ro-crate-0.4.11
- old
+ new
@@ -15,10 +15,18 @@
##
# Generate the crate's `ro-crate-metadata.jsonld`.
# @return [String] The rendered JSON-LD as a "prettified" string.
def generate
graph = crate.entities.map(&:properties).reject(&:empty?)
- JSON.pretty_generate('@context' => CONTEXT, '@graph' => graph)
+ JSON.pretty_generate('@context' => context, '@graph' => graph)
+ end
+
+ def context
+ @context || CONTEXT
+ end
+
+ def context= c
+ @context = c
end
private
def source