OSDN Git Service

* [shogi-server] Support a graceful shutdown. (Closes #38544)
[shogi-server/shogi-server.git] / test / mock_player.rb
1 $:.unshift File.join(File.dirname(__FILE__), "..")
2 require 'shogi_server/player'
3
4 class MockPlayer < ShogiServer::BasicPlayer
5   attr_reader :out
6   attr_accessor :game, :status, :protocol
7   attr_accessor :game_name
8   attr_reader :socket_buffer
9   attr_reader :rate
10   attr_accessor :last_command_at
11
12   def initialize
13     @name     = "mock_player"
14     @out      = []
15     @game     = nil
16     @status   = nil
17     @protocol = nil
18     @game_name = "dummy_game_name"
19     @socket_buffer = []
20     @rate = 1500
21   end
22
23   def write_safe(str)
24     @out << str
25   end
26 end
27
28