OSDN Git Service

[shogi-server] Added shogi_server/compatible.rb, which implements compatible
authorDaigo Moriwaki <beatles@users.sourceforge.jp>
Sat, 7 Jan 2012 03:52:17 +0000 (12:52 +0900)
committerDaigo Moriwaki <daigo@debian.org>
Sat, 7 Jan 2012 03:53:02 +0000 (12:53 +0900)
  methods and allows Ruby 1.8.7 to run the server.

- test/TC_floodgate.rb failed with Ruby 1.8.7. This issue has been fixed.

changelog
shogi_server.rb
shogi_server/compatible.rb [new file with mode: 0644]

index 9ee5707..215d0a3 100644 (file)
--- a/changelog
+++ b/changelog
@@ -1,3 +1,11 @@
+2012-01-07  Daigo Moriwaki <daigo at debian dot org>
+
+       * [shogi-server]
+         - Added shogi_server/compatible.rb, which implements compatible
+           methods and allows Ruby 1.8.7 to run the server.
+         - test/TC_floodgate.rb failed with Ruby 1.8.7. This issue has
+           been fixed.
+
 2012-01-06  Daigo Moriwaki <daigo at debian dot org>
 
        * [shogi-server]
index 56c778b..cd7a934 100644 (file)
@@ -29,6 +29,7 @@ require 'webrick'
 require 'fileutils'
 require 'logger'
 
+require 'shogi_server/compatible'
 require 'shogi_server/board'
 require 'shogi_server/game'
 require 'shogi_server/league'
diff --git a/shogi_server/compatible.rb b/shogi_server/compatible.rb
new file mode 100644 (file)
index 0000000..2e463b2
--- /dev/null
@@ -0,0 +1,26 @@
+## $Id$
+
+## Copyright (C) 2004 NABEYA Kenichi (aka nanami@2ch)
+## Copyright (C) 2007-2008 Daigo Moriwaki (daigo at debian dot org)
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+# Allow Ruby 1.8.7 to use Array#sample 
+# 
+unless ::Array.method_defined?(:sample)
+  class Array
+    alias_method :sample, :choice
+  end
+end