class Tetris::Model::Block

Constants

COLOR_CLEAR

Attributes

color[RW]

Public Class Methods

new(color = COLOR_CLEAR) click to toggle source

Initializes with color. Default color (gray) signifies an empty block

# File examples/tetris/model/block.rb, line 30
def initialize(color = COLOR_CLEAR)
  @color = color
end

Public Instance Methods

clear() click to toggle source

Clears block color. ‘quietly` option indicates if it should not notify observers by setting value quietly via variable not attribute writer.

# File examples/tetris/model/block.rb, line 35
def clear
  self.color = COLOR_CLEAR unless self.color == COLOR_CLEAR
end
clear?() click to toggle source
# File examples/tetris/model/block.rb, line 39
def clear?
  self.color == COLOR_CLEAR
end
occupied?() click to toggle source
# File examples/tetris/model/block.rb, line 43
def occupied?
  !clear?
end