Class: Shogi::Cell

Inherits:
Object
  • Object
show all
Defined in:
lib/shogi/cell.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(x, y, piece = nil, turn = nil) ⇒ Cell

Returns a new instance of Cell.



15
16
17
18
19
20
# File 'lib/shogi/cell.rb', line 15

def initialize(x, y, piece=nil, turn=nil)
  @x = x
  @y = y
  @piece = piece
  @turn = turn
end

Instance Attribute Details

#pieceObject

Returns the value of attribute piece.



13
14
15
# File 'lib/shogi/cell.rb', line 13

def piece
  @piece
end

#turnObject

Returns the value of attribute turn.



14
15
16
# File 'lib/shogi/cell.rb', line 14

def turn
  @turn
end

#xObject (readonly)

Returns the value of attribute x.



12
13
14
# File 'lib/shogi/cell.rb', line 12

def x
  @x
end

#yObject (readonly)

Returns the value of attribute y.



12
13
14
# File 'lib/shogi/cell.rb', line 12

def y
  @y
end

Class Method Details

.register(name) ⇒ Object



6
7
8
# File 'lib/shogi/cell.rb', line 6

def self.register(name)
  send(:include, Format.const_get(name).const_get("Cell"))
end