Sha256: 7ed28bec935f53f65143e8030f83026225fa869e46c1df4b9197d9952fc6cbbd

Contents?: true

Size: 509 Bytes

Versions: 10

Compression:

Stored size: 509 Bytes

Contents

module JustGo

  # = Stone
  # 
  # A stone that is placed on the board.
  class Stone
    def initialize(id: , player_number: , chain_id: nil)
      @id = id
      @player_number = player_number
      @chain_id = chain_id
    end

    attr_reader :id
    attr_reader :player_number
    attr_reader :chain_id

    def as_json
      {
        id: id,
        player_number: player_number,
        chain_id: chain_id
      }
    end

    def join_chain(stone)
      @chain_id = stone.chain_id
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
just_go-0.1.10 lib/just_go/stone.rb
just_go-0.1.9 lib/just_go/stone.rb
just_go-0.1.8 lib/just_go/stone.rb
just_go-0.1.7 lib/just_go/stone.rb
just_go-0.1.6 lib/just_go/stone.rb
just_go-0.1.5 lib/just_go/stone.rb
just_go-0.1.4 lib/just_go/stone.rb
just_go-0.1.3 lib/just_go/stone.rb
just_go-0.1.2 lib/just_go/stone.rb
just_go-0.1.0 lib/just_go/stone.rb