Class: Checkers::Ruby2D::SquareWithPiece
- Inherits:
-
Square
- Object
- Square
- Checkers::Ruby2D::SquareWithPiece
- Extended by:
- Forwardable
- Defined in:
- lib/checkers/ruby2d/square_with_piece.rb
Instance Attribute Summary collapse
-
#piece ⇒ Object
readonly
Returns the value of attribute piece.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ SquareWithPiece
constructor
A new instance of SquareWithPiece.
- #remove ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ SquareWithPiece
Returns a new instance of SquareWithPiece.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/checkers/ruby2d/square_with_piece.rb', line 11 def initialize(opts = {}) @piece = Piece.new( x: opts[:x] + Checkers::GUI::CIRCLE_TRANSLATION, y: opts[:y] + Checkers::GUI::CIRCLE_TRANSLATION, z: 1, radius: Checkers::GUI::RADIUS, piece: opts[:piece] ) super(opts.slice(:x, :y, :size, :color)) end |
Instance Attribute Details
#piece ⇒ Object (readonly)
Returns the value of attribute piece.
9 10 11 |
# File 'lib/checkers/ruby2d/square_with_piece.rb', line 9 def piece @piece end |
Instance Method Details
#remove ⇒ Object
22 23 24 25 |
# File 'lib/checkers/ruby2d/square_with_piece.rb', line 22 def remove @piece.remove super end |