Class: Field
- Inherits:
-
Object
- Object
- Field
- Defined in:
- lib/software_challenge_client/field.rb
Overview
Ein Feld des Spielfelds. Ein Spielfeld ist durch den index eindeutig identifiziert. Das type Attribut gibt an, um welchen Feldtyp es sich handelt
Instance Attribute Summary collapse
-
#index ⇒ Integer
readonly
Der Index des Feldes (0 bis 64).
-
#type ⇒ FieldType
Der Typ des Feldes.
Instance Method Summary collapse
- #==(another_field) ⇒ Object
-
#initialize(type, index) ⇒ Field
constructor
Konstruktor.
- #to_s ⇒ Object
Constructor Details
#initialize(type, index) ⇒ Field
Konstruktor
18 19 20 21 |
# File 'lib/software_challenge_client/field.rb', line 18 def initialize(type, index) self.type = type @index = index end |
Instance Attribute Details
#index ⇒ Integer (readonly)
Returns der Index des Feldes (0 bis 64).
12 13 14 |
# File 'lib/software_challenge_client/field.rb', line 12 def index @index end |
#type ⇒ FieldType
Returns der Typ des Feldes.
9 10 11 |
# File 'lib/software_challenge_client/field.rb', line 9 def type @type end |
Instance Method Details
#==(another_field) ⇒ Object
23 24 25 26 |
# File 'lib/software_challenge_client/field.rb', line 23 def ==(another_field) return self.type == another_field.type && self.index == another_field.index end |
#to_s ⇒ Object
28 29 30 |
# File 'lib/software_challenge_client/field.rb', line 28 def to_s return "Feld ##{self.index}, Typ = #{self.type}" end |