Sha256: 6b2ae9c6cd991d4f1196b712e98e7d073b4e0beb27d34ec2cb9d3b42b81624ba
Contents?: true
Size: 1.37 KB
Versions: 3
Compression:
Stored size: 1.37 KB
Contents
# frozen_string_literal: true module ConvenientService module Support class UniqueValue ## # @!attribute [r] label # @return [String] # attr_reader :label ## # @param label [String] # @return [void] # def initialize(label = default_label) @label = label end ## # @param other [Object] Can be any type. # @return [Boolean] # # @internal # NOTE: Every single Ruby object responds to `object_id`. # def ==(other) return unless other.instance_of?(self.class) object_id == other.object_id end ## # @param other [Object] Can be any type. # @return [Boolean] # def ===(other) self == other end ## # @param other [Object] Can be any type. # @return [Boolean] # # @internal # TODO: What to do in case unique value is used as hash key? See `ConveninetService::Support::Cache::Entities::Key`. # def eql?(other) self == other end ## # @return [String] # def inspect return default_label if label.nil? return default_label if label.empty? label end private ## # @return [String] # def default_label "unique_value_#{object_id}" end end end end
Version data entries
3 entries across 3 versions & 1 rubygems