Class: Shogi::Cell
- Inherits:
-
Object
- Object
- Shogi::Cell
- Defined in:
- lib/shogi/cell.rb
Instance Attribute Summary collapse
-
#piece ⇒ Object
Returns the value of attribute piece.
-
#turn ⇒ Object
Returns the value of attribute turn.
-
#x ⇒ Object
readonly
Returns the value of attribute x.
-
#y ⇒ Object
readonly
Returns the value of attribute y.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(x, y, piece = nil, turn = nil) ⇒ Cell
constructor
A new instance of Cell.
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
#piece ⇒ Object
Returns the value of attribute piece.
13 14 15 |
# File 'lib/shogi/cell.rb', line 13 def piece @piece end |
#turn ⇒ Object
Returns the value of attribute turn.
14 15 16 |
# File 'lib/shogi/cell.rb', line 14 def turn @turn end |
#x ⇒ Object (readonly)
Returns the value of attribute x.
12 13 14 |
# File 'lib/shogi/cell.rb', line 12 def x @x end |
#y ⇒ Object (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 |