Sha256: db3a6ff01b70714444738930817261e492241b950195f7e0327d4bfddb96f0ce
Contents?: true
Size: 646 Bytes
Versions: 6
Compression:
Stored size: 646 Bytes
Contents
# frozen_string_literal: true module Valkyrie # A simple ID class to keep IDs distinguished from strings class ID attr_reader :id delegate :empty?, to: :id def initialize(id) @id = id.to_s end def to_s id end delegate :hash, to: :state def eql?(other) other.class == self.class && other.state == state end alias == eql? def to_uri return RDF::Literal.new(id.to_s, datatype: RDF::URI("http://example.com/valkyrie_id")) if id.to_s.include?("://") ::RDF::URI(ActiveFedora::Base.id_to_uri(id)) end protected def state [@id] end end end
Version data entries
6 entries across 6 versions & 1 rubygems