Sha256: 574aeb9c826006b5732c246ab73b95103551a2273f21c23ea65ae5c0919a0a56

Contents?: true

Size: 542 Bytes

Versions: 15

Compression:

Stored size: 542 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

15 entries across 15 versions & 1 rubygems

Version Path
valkyrie-3.4.0 lib/valkyrie/rdf_patches.rb
valkyrie-3.3.0 lib/valkyrie/rdf_patches.rb
valkyrie-3.1.5 lib/valkyrie/rdf_patches.rb
valkyrie-3.1.4 lib/valkyrie/rdf_patches.rb
valkyrie-3.1.3 lib/valkyrie/rdf_patches.rb
valkyrie-3.1.2 lib/valkyrie/rdf_patches.rb
valkyrie-3.1.1 lib/valkyrie/rdf_patches.rb
valkyrie-3.1.0 lib/valkyrie/rdf_patches.rb
valkyrie-3.0.3 lib/valkyrie/rdf_patches.rb
valkyrie-3.0.2 lib/valkyrie/rdf_patches.rb
valkyrie-3.0.1 lib/valkyrie/rdf_patches.rb
valkyrie-3.0.0 lib/valkyrie/rdf_patches.rb
valkyrie-3.0.0.pre.rc.1 lib/valkyrie/rdf_patches.rb
valkyrie-3.0.0.pre.beta.3 lib/valkyrie/rdf_patches.rb
valkyrie-3.0.0.pre.beta.2 lib/valkyrie/rdf_patches.rb