Sha256: 2c3cd56ec17f1a72e909bbd3edb1d259532735b27458ba25a5bf0987f213873a

Contents?: true

Size: 761 Bytes

Versions: 4

Compression:

Stored size: 761 Bytes

Contents

# encoding: UTF-8
require_relative 'field_type'

# Ein Feld des Spielfelds. Ein Spielfeld ist durch den index eindeutig identifiziert.
# Das type Attribut gibt an, um welchen Feldtyp es sich handelt
class Field
  # @!attribute [rw] type
  # @return [FieldType] der Typ des Feldes
  attr_accessor :type
  # @!attribute [r] index
  # @return [Integer] der Index des Feldes (0 bis 64)
  attr_reader :index

  # Konstruktor
  #
  # @param type [FieldType] Feldtyp
  # @param index [Integer] Index
  def initialize(type, index)
    self.type = type
    @index = index
  end

  def ==(another_field)
    return self.type == another_field.type &&
      self.index == another_field.index
  end

  def to_s
    return "Feld ##{self.index}, Typ = #{self.type}"
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
software_challenge_client-1.2.1 lib/software_challenge_client/field.rb
software_challenge_client-1.2.0 lib/software_challenge_client/field.rb
software_challenge_client-1.1.0 lib/software_challenge_client/field.rb
software_challenge_client-1.0.0 lib/software_challenge_client/field.rb