Sha256: 5b6d7071826519ce1f46c8a9c63265ca3881237f4f029d8ba1c76a51190dd35d

Contents?: true

Size: 541 Bytes

Versions: 5

Compression:

Stored size: 541 Bytes

Contents

# frozen_string_literal: true
##
# These patches are necessary for the postgres adapter to build JSON-LD versions
# of RDF objects when `to_json` is called on them - that way they're stored in
# the database as a standard format.
module RDF
  class Literal
    def as_json(*_args)
      ::JSON::LD::API.fromRdf([RDF::Statement.new(RDF::URI(""), RDF::URI(""), self)])[0][""][0]
    end
  end
  class URI
    def as_json(*_args)
      ::JSON::LD::API.fromRdf([RDF::Statement.new(RDF::URI(""), RDF::URI(""), self)])[0][""][0]
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
valkyrie-3.0.0.pre.beta.1 lib/valkyrie/rdf_patches.rb
valkyrie-2.2.0 lib/valkyrie/rdf_patches.rb
valkyrie-2.1.2 lib/valkyrie/rdf_patches.rb
valkyrie-2.1.1 lib/valkyrie/rdf_patches.rb
valkyrie-2.1.0 lib/valkyrie/rdf_patches.rb