Sha256: efd42814c9d8d3d45c759fc5674f58ee0f281c3d148d537b6a2a3e4793de2ef6

Contents?: true

Size: 446 Bytes

Versions: 6

Compression:

Stored size: 446 Bytes

Contents

# frozen_string_literal: true

module Basketball
  class Entity
    extend Forwardable
    include Comparable

    attr_reader :id

    def_delegators :id, :to_s

    def initialize(id)
      raise ArgumentError, 'id is required' if id.to_s.empty?

      @id = id.to_s.upcase
    end

    def <=>(other)
      id <=> other.id
    end

    def ==(other)
      id == other.id
    end
    alias eql? ==

    def hash
      id.hash
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
basketball-0.0.8 lib/basketball/entity.rb
basketball-0.0.7 lib/basketball/entity.rb
basketball-0.0.6 lib/basketball/entity.rb
basketball-0.0.5 lib/basketball/entity.rb
basketball-0.0.4 lib/basketball/entity.rb
basketball-0.0.3 lib/basketball/entity.rb