Sha256: 9b3c6bba2d5cd3549c42fed6a42e252990082717a990a9d729d5d5db97c0dc05

Contents?: true

Size: 625 Bytes

Versions: 4

Compression:

Stored size: 625 Bytes

Contents

require 'just_backgammon/common'

module JustBackgammon

  # = Piece
  #
  # A piece owned by a player that moves around the board.
  class Piece
    extend Common

    # A new instance of Piece.
    #
    # @param [Fixnum] owner
    #   The owner of the piece.
    #
    # ==== Example:
    #   # Instantiates a new Piece
    #   JustBackgammon::Piece.new(1)
    def initialize(owner:)
      @owner = owner
    end

    # @return [Fixnum] the owner of the piece
    attr_reader :owner

    # A hashed serialized representation of the piece.
    #
    # @return [Hash]
    def as_json
      { owner: owner }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
just_backgammon-0.2.0 lib/just_backgammon/piece.rb
just_backgammon-0.1.2 lib/just_backgammon/piece.rb
just_backgammon-0.1.1 lib/just_backgammon/piece.rb
just_backgammon-0.1.0 lib/just_backgammon/piece.rb