Sha256: d3f404444e85ed8c7619f05b6eecd1b1393097a0586c3fba5fb1f427b324ac45
Contents?: true
Size: 651 Bytes
Versions: 17
Compression:
Stored size: 651 Bytes
Contents
# frozen_string_literal: true module Valkyrie # A simple ID class to keep IDs distinguished from strings # In order for an object to be queryable via joins, it needs # to be added as a reference via a Valkyrie::ID rather than just a string ID. class ID attr_reader :id delegate :empty?, to: :id def initialize(id) @id = id.to_s end ## # @return [String] def to_s to_str end ## # @return [String] def to_str id end delegate :hash, to: :state def eql?(other) other == to_str end alias == eql? protected def state [@id] end end end
Version data entries
17 entries across 17 versions & 1 rubygems