Sha256: 1f3c56c7a18ccb774420fab8938dd31cac36324683ab0b9c6188538e733f7955

Contents?: true

Size: 510 Bytes

Versions: 2

Compression:

Stored size: 510 Bytes

Contents

# frozen_string_literal: true

module Basketball
  module Drafting
    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
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
basketball-0.0.2 lib/basketball/drafting/entity.rb
basketball-0.0.1 lib/basketball/drafting/entity.rb