class Snake::Model::Vertebra
Constants
- ORIENTATIONS
Attributes
column[RW]
orientation[RW]
row[RW]
snake[R]
orientation is needed for snake occuppied cells (but not apple cells)
Public Class Methods
new(snake: , row: , column: , orientation: )
click to toggle source
# File examples/snake/model/vertebra.rb, line 9 def initialize(snake: , row: , column: , orientation: ) @row = row || rand(snake.game.height) @column = column || rand(snake.game.width) @orientation = orientation || ORIENTATIONS.sample @snake = snake end
Public Instance Methods
inspect()
click to toggle source
inspect is overridden to prevent printing very long stack traces
# File examples/snake/model/vertebra.rb, line 17 def inspect "#{super[0, 150]}... >" end