OSDN Git Service

Merge remote-tracking branch 'origin/wdoor-stable' into wdoor-stable
[shogi-server/shogi-server.git] / shogi_server / piece.rb
index 64b918a..8717dff 100644 (file)
@@ -154,18 +154,17 @@ class Piece
     @promoted_name
   end
 
+  def current_name
+    return @promoted ? @promoted_name : @name
+  end
+
   def to_s
     if (@sente)
       sg = "+"
     else
       sg = "-"
     end
-    if (@promoted)
-      n = @promoted_name
-    else
-      n = @name
-    end
-    return sg + n
+    return sg + current_name
   end
 end