Class: Snake::PreviousVectorRecord
- Inherits:
-
Object
- Object
- Snake::PreviousVectorRecord
- Defined in:
- lib/snake.rb
Instance Attribute Summary collapse
-
#remaining ⇒ Object
readonly
Returns the value of attribute remaining.
-
#vector ⇒ Object
readonly
Returns the value of attribute vector.
Instance Method Summary collapse
- #decrement ⇒ Object
- #increment ⇒ Object
-
#initialize(vector, remaining) ⇒ PreviousVectorRecord
constructor
A new instance of PreviousVectorRecord.
- #valid? ⇒ Boolean
Constructor Details
#initialize(vector, remaining) ⇒ PreviousVectorRecord
Returns a new instance of PreviousVectorRecord.
7 8 9 10 |
# File 'lib/snake.rb', line 7 def initialize(vector, remaining) @vector = vector @remaining = remaining end |
Instance Attribute Details
#remaining ⇒ Object (readonly)
Returns the value of attribute remaining.
6 7 8 |
# File 'lib/snake.rb', line 6 def remaining @remaining end |
#vector ⇒ Object (readonly)
Returns the value of attribute vector.
6 7 8 |
# File 'lib/snake.rb', line 6 def vector @vector end |
Instance Method Details
#decrement ⇒ Object
12 13 14 |
# File 'lib/snake.rb', line 12 def decrement @remaining -= 1 end |
#increment ⇒ Object
16 17 18 |
# File 'lib/snake.rb', line 16 def increment @remaining += 1 end |
#valid? ⇒ Boolean
20 21 22 |
# File 'lib/snake.rb', line 20 def valid? @remaining > 0 end |