chess 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +4 -4
  2. data/README.rdoc +1 -1
  3. data/Rakefile +3 -4
  4. data/chess.gemspec +5 -0
  5. data/doc/Chess.html +112 -0
  6. data/doc/Chess/BadNotationError.html +107 -0
  7. data/doc/Chess/Board.html +703 -0
  8. data/doc/Chess/CGame.html +1005 -0
  9. data/doc/Chess/Game.html +684 -0
  10. data/doc/Chess/Gnuchess.html +215 -0
  11. data/doc/Chess/IllegalMoveError.html +105 -0
  12. data/doc/Chess/InvalidFenFormatError.html +105 -0
  13. data/doc/Chess/InvalidPgnFormatError.html +105 -0
  14. data/doc/Chess/Pgn.html +309 -0
  15. data/doc/Chess/UTF8Notation.html +174 -0
  16. data/doc/README_rdoc.html +143 -0
  17. data/doc/created.rid +15 -15
  18. data/doc/css/fonts.css +167 -0
  19. data/doc/css/rdoc.css +590 -0
  20. data/doc/fonts/Lato-Light.ttf +0 -0
  21. data/doc/fonts/Lato-LightItalic.ttf +0 -0
  22. data/doc/fonts/Lato-Regular.ttf +0 -0
  23. data/doc/fonts/Lato-RegularItalic.ttf +0 -0
  24. data/doc/fonts/SourceCodePro-Bold.ttf +0 -0
  25. data/doc/fonts/SourceCodePro-Regular.ttf +0 -0
  26. data/doc/images/add.png +0 -0
  27. data/doc/images/arrow_up.png +0 -0
  28. data/doc/images/brick.png +0 -0
  29. data/doc/images/brick_link.png +0 -0
  30. data/doc/images/bug.png +0 -0
  31. data/doc/images/bullet_black.png +0 -0
  32. data/doc/images/bullet_toggle_minus.png +0 -0
  33. data/doc/images/bullet_toggle_plus.png +0 -0
  34. data/doc/images/date.png +0 -0
  35. data/doc/images/delete.png +0 -0
  36. data/doc/images/find.png +0 -0
  37. data/doc/images/loadingAnimation.gif +0 -0
  38. data/doc/images/macFFBgHack.png +0 -0
  39. data/doc/images/package.png +0 -0
  40. data/doc/images/page_green.png +0 -0
  41. data/doc/images/page_white_text.png +0 -0
  42. data/doc/images/page_white_width.png +0 -0
  43. data/doc/images/plugin.png +0 -0
  44. data/doc/images/ruby.png +0 -0
  45. data/doc/images/tag_blue.png +0 -0
  46. data/doc/images/tag_green.png +0 -0
  47. data/doc/images/transparent.png +0 -0
  48. data/doc/images/wrench.png +0 -0
  49. data/doc/images/wrench_orange.png +0 -0
  50. data/doc/images/zoom.png +0 -0
  51. data/doc/index.html +159 -12
  52. data/doc/js/darkfish.js +161 -0
  53. data/doc/js/jquery.js +4 -0
  54. data/doc/js/navigation.js.gz +0 -0
  55. data/doc/js/search.js +109 -0
  56. data/doc/js/search_index.js +1 -1
  57. data/doc/js/search_index.js.gz +0 -0
  58. data/doc/js/searcher.js +1 -0
  59. data/doc/js/searcher.js.gz +0 -0
  60. data/doc/table_of_contents.html +331 -0
  61. data/ext/chess.c +5 -2
  62. data/ext/game.c +1 -1
  63. data/ext/game.h +1 -1
  64. data/lib/chess/game.rb +1 -1
  65. data/lib/chess/pgn.rb +5 -1
  66. data/lib/chess/version.rb +1 -1
  67. metadata +112 -46
  68. data/doc/apple-touch-icon.png +0 -0
  69. data/doc/classes/Chess.html +0 -162
  70. data/doc/classes/Chess/BadNotationError.html +0 -84
  71. data/doc/classes/Chess/Board.html +0 -795
  72. data/doc/classes/Chess/CGame.html +0 -1168
  73. data/doc/classes/Chess/Game.html +0 -775
  74. data/doc/classes/Chess/Gnuchess.html +0 -206
  75. data/doc/classes/Chess/IllegalMoveError.html +0 -82
  76. data/doc/classes/Chess/InvalidFenFormatError.html +0 -82
  77. data/doc/classes/Chess/InvalidPgnFormatError.html +0 -82
  78. data/doc/classes/Chess/Pgn.html +0 -332
  79. data/doc/classes/Chess/UTF8Notation.html +0 -175
  80. data/doc/css/github.css +0 -123
  81. data/doc/css/main.css +0 -323
  82. data/doc/css/panel.css +0 -384
  83. data/doc/css/reset.css +0 -48
  84. data/doc/favicon.ico +0 -0
  85. data/doc/files/README_rdoc.html +0 -122
  86. data/doc/files/ext/bitboard_c.html +0 -68
  87. data/doc/files/ext/board_c.html +0 -68
  88. data/doc/files/ext/chess_c.html +0 -68
  89. data/doc/files/ext/common_c.html +0 -68
  90. data/doc/files/ext/game_c.html +0 -68
  91. data/doc/files/ext/special_c.html +0 -68
  92. data/doc/files/lib/chess/exceptions_rb.html +0 -94
  93. data/doc/files/lib/chess/game_rb.html +0 -84
  94. data/doc/files/lib/chess/gnuchess_rb.html +0 -84
  95. data/doc/files/lib/chess/pgn_rb.html +0 -84
  96. data/doc/files/lib/chess/utf8_notation_rb.html +0 -84
  97. data/doc/files/lib/chess/version_rb.html +0 -85
  98. data/doc/files/lib/chess_rb.html +0 -84
  99. data/doc/i/arrows.png +0 -0
  100. data/doc/i/results_bg.png +0 -0
  101. data/doc/i/tree_bg.png +0 -0
  102. data/doc/js/highlight.pack.js +0 -1
  103. data/doc/js/jquery-1.3.2.min.js +0 -19
  104. data/doc/js/jquery-effect.js +0 -593
  105. data/doc/js/main.js +0 -24
  106. data/doc/js/searchdoc.js +0 -449
  107. data/doc/panel/index.html +0 -73
  108. data/doc/panel/links.html +0 -34
  109. data/doc/panel/tree.js +0 -1
@@ -0,0 +1,309 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta charset="UTF-8">
6
+
7
+ <title>class Chess::Pgn - Chess</title>
8
+
9
+ <script type="text/javascript">
10
+ var rdoc_rel_prefix = "../";
11
+ var index_rel_prefix = "../";
12
+ </script>
13
+
14
+ <script src="../js/jquery.js"></script>
15
+ <script src="../js/darkfish.js"></script>
16
+
17
+ <link href="../css/fonts.css" rel="stylesheet">
18
+ <link href="../css/rdoc.css" rel="stylesheet">
19
+
20
+
21
+
22
+ <body id="top" role="document" class="class">
23
+ <nav role="navigation">
24
+ <div id="project-navigation">
25
+ <div id="home-section" role="region" title="Quick navigation" class="nav-section">
26
+ <h2>
27
+ <a href="../index.html" rel="home">Home</a>
28
+ </h2>
29
+
30
+ <div id="table-of-contents-navigation">
31
+ <a href="../table_of_contents.html#pages">Pages</a>
32
+ <a href="../table_of_contents.html#classes">Classes</a>
33
+ <a href="../table_of_contents.html#methods">Methods</a>
34
+ </div>
35
+ </div>
36
+
37
+ <div id="search-section" role="search" class="project-section initially-hidden">
38
+ <form action="#" method="get" accept-charset="utf-8">
39
+ <div id="search-field-wrapper">
40
+ <input id="search-field" role="combobox" aria-label="Search"
41
+ aria-autocomplete="list" aria-controls="search-results"
42
+ type="text" name="search" placeholder="Search" spellcheck="false"
43
+ title="Type to search, Up and Down to navigate, Enter to load">
44
+ </div>
45
+
46
+ <ul id="search-results" aria-label="Search Results"
47
+ aria-busy="false" aria-expanded="false"
48
+ aria-atomic="false" class="initially-hidden"></ul>
49
+ </form>
50
+ </div>
51
+
52
+ </div>
53
+
54
+
55
+
56
+ <div id="class-metadata">
57
+
58
+ <div id="parent-class-section" class="nav-section">
59
+ <h3>Parent</h3>
60
+
61
+
62
+ <p class="link">Object
63
+
64
+ </div>
65
+
66
+
67
+
68
+ <!-- Method Quickref -->
69
+ <div id="method-list-section" class="nav-section">
70
+ <h3>Methods</h3>
71
+
72
+ <ul class="link-list" role="directory">
73
+
74
+ <li ><a href="#method-c-new">::new</a>
75
+
76
+ <li ><a href="#method-i-load">#load</a>
77
+
78
+ <li ><a href="#method-i-to_s">#to_s</a>
79
+
80
+ <li ><a href="#method-i-write">#write</a>
81
+
82
+ </ul>
83
+ </div>
84
+
85
+ </div>
86
+ </nav>
87
+
88
+ <main role="main" aria-labelledby="class-Chess::Pgn">
89
+ <h1 id="class-Chess::Pgn" class="class">
90
+ class Chess::Pgn
91
+ </h1>
92
+
93
+ <section class="description">
94
+
95
+ <p>Rappresents a game in PGN (Portable <a href="Game.html">Game</a> Notation)
96
+ format.</p>
97
+
98
+ </section>
99
+
100
+
101
+
102
+
103
+ <section id="5Buntitled-5D" class="documentation-section">
104
+
105
+
106
+
107
+
108
+
109
+ <section class="constants-list">
110
+ <header>
111
+ <h3>Constants</h3>
112
+ </header>
113
+ <dl>
114
+
115
+ <dt id="TAGS">TAGS
116
+
117
+ <dd><p>Array that include PGN standard tags.</p>
118
+
119
+
120
+ </dl>
121
+ </section>
122
+
123
+
124
+
125
+
126
+
127
+ <section id="public-class-5Buntitled-5D-method-details" class="method-section">
128
+ <header>
129
+ <h3>Public Class Methods</h3>
130
+ </header>
131
+
132
+
133
+ <div id="method-c-new" class="method-detail ">
134
+
135
+ <div class="method-heading">
136
+ <span class="method-name">new</span><span
137
+ class="method-args">(filename = nil)</span>
138
+
139
+ <span class="method-click-advice">click to toggle source</span>
140
+
141
+ </div>
142
+
143
+
144
+ <div class="method-description">
145
+
146
+ <p>Creates a new PGN. If param <code>filename</code>, load it from file.</p>
147
+
148
+
149
+
150
+
151
+ <div class="method-source-code" id="new-source">
152
+ <pre><span class="ruby-comment"># File lib/chess/pgn.rb, line 12</span>
153
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">filename</span> = <span class="ruby-keyword">nil</span>)
154
+ <span class="ruby-keyword">self</span>.<span class="ruby-identifier">load</span>(<span class="ruby-identifier">filename</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">filename</span>
155
+ <span class="ruby-ivar">@date</span> = <span class="ruby-string">&#39;??&#39;</span>
156
+ <span class="ruby-ivar">@round</span> = <span class="ruby-string">&#39;1&#39;</span>
157
+ <span class="ruby-keyword">end</span></pre>
158
+ </div>
159
+
160
+ </div>
161
+
162
+
163
+
164
+
165
+ </div>
166
+
167
+
168
+ </section>
169
+
170
+ <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
171
+ <header>
172
+ <h3>Public Instance Methods</h3>
173
+ </header>
174
+
175
+
176
+ <div id="method-i-load" class="method-detail ">
177
+
178
+ <div class="method-heading">
179
+ <span class="method-name">load</span><span
180
+ class="method-args">(filename)</span>
181
+
182
+ <span class="method-click-advice">click to toggle source</span>
183
+
184
+ </div>
185
+
186
+
187
+ <div class="method-description">
188
+
189
+ <p>Load a PGN from file.</p>
190
+
191
+
192
+
193
+
194
+ <div class="method-source-code" id="load-source">
195
+ <pre><span class="ruby-comment"># File lib/chess/pgn.rb, line 19</span>
196
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">load</span>(<span class="ruby-identifier">filename</span>)
197
+ <span class="ruby-identifier">data</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">filename</span>, <span class="ruby-string">&#39;r&#39;</span>).<span class="ruby-identifier">read</span>
198
+ <span class="ruby-identifier">data</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp">/\{.*?\}/</span>, <span class="ruby-string">&#39;&#39;</span>)
199
+ <span class="ruby-constant">TAGS</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span>
200
+ <span class="ruby-identifier">instance_variable_set</span>(<span class="ruby-node">&quot;@#{t}&quot;</span>, <span class="ruby-identifier">data</span>.<span class="ruby-identifier">match</span>(<span class="ruby-node">/^\[#{t.capitalize} &quot;.*&quot;\]\s?$/</span>).<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">strip</span>[<span class="ruby-identifier">t</span>.<span class="ruby-identifier">size</span><span class="ruby-operator">+</span><span class="ruby-value">3</span><span class="ruby-operator">..</span><span class="ruby-value">-3</span>])
201
+ <span class="ruby-keyword">end</span>
202
+ <span class="ruby-ivar">@result</span> = <span class="ruby-string">&#39;1/2-1/2&#39;</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@result</span> <span class="ruby-operator">==</span> <span class="ruby-string">&#39;1/2&#39;</span>
203
+ <span class="ruby-identifier">game_index</span> = <span class="ruby-identifier">data</span>.<span class="ruby-identifier">index</span>(<span class="ruby-regexp">/^1\./</span>)
204
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">Chess</span><span class="ruby-operator">::</span><span class="ruby-constant">InvalidPgnFormatError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">filename</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">game_index</span>.<span class="ruby-identifier">nil?</span>
205
+ <span class="ruby-identifier">game</span> = <span class="ruby-identifier">data</span>[<span class="ruby-identifier">game_index</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>].<span class="ruby-identifier">strip</span>
206
+ <span class="ruby-ivar">@moves</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-string">&quot;\n&quot;</span>, <span class="ruby-string">&#39; &#39;</span>).<span class="ruby-identifier">split</span>(<span class="ruby-regexp">/\d+\./</span>).<span class="ruby-identifier">collect</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">strip</span>}[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>].<span class="ruby-identifier">collect</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">&#39; &#39;</span>)}.<span class="ruby-identifier">flatten</span>
207
+ <span class="ruby-ivar">@moves</span>.<span class="ruby-identifier">delete_at</span>(<span class="ruby-ivar">@moves</span>.<span class="ruby-identifier">size</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>) <span class="ruby-keyword">if</span> <span class="ruby-ivar">@moves</span>.<span class="ruby-identifier">last</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/(0-1)|(1-0)|(1\/2)|(1\/2-1\/2)|(\*)/</span>
208
+ <span class="ruby-keyword">return</span> <span class="ruby-keyword">self</span>
209
+ <span class="ruby-keyword">end</span></pre>
210
+ </div>
211
+
212
+ </div>
213
+
214
+
215
+
216
+
217
+ </div>
218
+
219
+
220
+ <div id="method-i-to_s" class="method-detail ">
221
+
222
+ <div class="method-heading">
223
+ <span class="method-name">to_s</span><span
224
+ class="method-args">()</span>
225
+
226
+ <span class="method-click-advice">click to toggle source</span>
227
+
228
+ </div>
229
+
230
+
231
+ <div class="method-description">
232
+
233
+ <p>PGN to string.</p>
234
+
235
+
236
+
237
+
238
+ <div class="method-source-code" id="to_s-source">
239
+ <pre><span class="ruby-comment"># File lib/chess/pgn.rb, line 35</span>
240
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">to_s</span>
241
+ <span class="ruby-identifier">s</span> = <span class="ruby-string">&#39;&#39;</span>
242
+ <span class="ruby-constant">TAGS</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span>
243
+ <span class="ruby-identifier">tag</span> = <span class="ruby-identifier">instance_variable_get</span>(<span class="ruby-node">&quot;@#{t}&quot;</span>)
244
+ <span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;[#{t.capitalize} \&quot;#{tag}\&quot;]\n&quot;</span>
245
+ <span class="ruby-keyword">end</span>
246
+ <span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;\n&quot;</span>
247
+ <span class="ruby-identifier">m</span> = <span class="ruby-string">&#39;&#39;</span>
248
+ <span class="ruby-ivar">@moves</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">move</span>, <span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
249
+ <span class="ruby-identifier">m</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;#{i/2+1}. &quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">i</span> <span class="ruby-operator">%</span> <span class="ruby-value">2</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
250
+ <span class="ruby-identifier">m</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;#{move} &quot;</span>
251
+ <span class="ruby-keyword">end</span>
252
+ <span class="ruby-identifier">m</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@result</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@result</span>.<span class="ruby-identifier">nil?</span>
253
+ <span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">m</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">/(.{1,78})(?: +|$)\n?|(.{78})/</span>, <span class="ruby-string">&quot;\\1\\2\n&quot;</span>)
254
+ <span class="ruby-keyword">end</span></pre>
255
+ </div>
256
+
257
+ </div>
258
+
259
+
260
+
261
+
262
+ </div>
263
+
264
+
265
+ <div id="method-i-write" class="method-detail ">
266
+
267
+ <div class="method-heading">
268
+ <span class="method-name">write</span><span
269
+ class="method-args">(filename)</span>
270
+
271
+ <span class="method-click-advice">click to toggle source</span>
272
+
273
+ </div>
274
+
275
+
276
+ <div class="method-description">
277
+
278
+ <p>Write PGN to file.</p>
279
+
280
+
281
+
282
+
283
+ <div class="method-source-code" id="write-source">
284
+ <pre><span class="ruby-comment"># File lib/chess/pgn.rb, line 52</span>
285
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">write</span>(<span class="ruby-identifier">filename</span>)
286
+ <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">filename</span>, <span class="ruby-string">&#39;w&#39;</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">write</span>(<span class="ruby-keyword">self</span>.<span class="ruby-identifier">to_s</span>) }
287
+ <span class="ruby-keyword">end</span></pre>
288
+ </div>
289
+
290
+ </div>
291
+
292
+
293
+
294
+
295
+ </div>
296
+
297
+
298
+ </section>
299
+
300
+ </section>
301
+ </main>
302
+
303
+
304
+ <footer id="validator-badges" role="contentinfo">
305
+ <p><a href="http://validator.w3.org/check/referer">Validate</a>
306
+ <p>Generated by <a href="https://rdoc.github.io/rdoc">RDoc</a> 5.1.0.
307
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
308
+ </footer>
309
+
@@ -0,0 +1,174 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta charset="UTF-8">
6
+
7
+ <title>module Chess::UTF8Notation - Chess</title>
8
+
9
+ <script type="text/javascript">
10
+ var rdoc_rel_prefix = "../";
11
+ var index_rel_prefix = "../";
12
+ </script>
13
+
14
+ <script src="../js/jquery.js"></script>
15
+ <script src="../js/darkfish.js"></script>
16
+
17
+ <link href="../css/fonts.css" rel="stylesheet">
18
+ <link href="../css/rdoc.css" rel="stylesheet">
19
+
20
+
21
+
22
+ <body id="top" role="document" class="module">
23
+ <nav role="navigation">
24
+ <div id="project-navigation">
25
+ <div id="home-section" role="region" title="Quick navigation" class="nav-section">
26
+ <h2>
27
+ <a href="../index.html" rel="home">Home</a>
28
+ </h2>
29
+
30
+ <div id="table-of-contents-navigation">
31
+ <a href="../table_of_contents.html#pages">Pages</a>
32
+ <a href="../table_of_contents.html#classes">Classes</a>
33
+ <a href="../table_of_contents.html#methods">Methods</a>
34
+ </div>
35
+ </div>
36
+
37
+ <div id="search-section" role="search" class="project-section initially-hidden">
38
+ <form action="#" method="get" accept-charset="utf-8">
39
+ <div id="search-field-wrapper">
40
+ <input id="search-field" role="combobox" aria-label="Search"
41
+ aria-autocomplete="list" aria-controls="search-results"
42
+ type="text" name="search" placeholder="Search" spellcheck="false"
43
+ title="Type to search, Up and Down to navigate, Enter to load">
44
+ </div>
45
+
46
+ <ul id="search-results" aria-label="Search Results"
47
+ aria-busy="false" aria-expanded="false"
48
+ aria-atomic="false" class="initially-hidden"></ul>
49
+ </form>
50
+ </div>
51
+
52
+ </div>
53
+
54
+
55
+
56
+ <div id="class-metadata">
57
+
58
+
59
+
60
+
61
+ <!-- Method Quickref -->
62
+ <div id="method-list-section" class="nav-section">
63
+ <h3>Methods</h3>
64
+
65
+ <ul class="link-list" role="directory">
66
+
67
+ <li ><a href="#method-i-to_utf8">#to_utf8</a>
68
+
69
+ </ul>
70
+ </div>
71
+
72
+ </div>
73
+ </nav>
74
+
75
+ <main role="main" aria-labelledby="module-Chess::UTF8Notation">
76
+ <h1 id="module-Chess::UTF8Notation" class="module">
77
+ module Chess::UTF8Notation
78
+ </h1>
79
+
80
+ <section class="description">
81
+
82
+ <p>With this module is possible call the method <code>to_utf8</code> on a
83
+ string. This method convert the chess piece identifier character into UTF8
84
+ chess character, for example:</p>
85
+
86
+ <pre>:001 &gt; require &#39;chess/utf8_notation&#39;
87
+ =&gt; true
88
+ :002 &gt; &#39;Qf7#&#39;.to_utf8
89
+ =&gt; &#39;♕f7#&#39;</pre>
90
+
91
+ <p>To use this utility explicit require is needed: <code>require
92
+ &#39;chess/utf8_notation&#39;</code></p>
93
+
94
+ </section>
95
+
96
+
97
+
98
+
99
+ <section id="5Buntitled-5D" class="documentation-section">
100
+
101
+
102
+
103
+
104
+
105
+ <section class="constants-list">
106
+ <header>
107
+ <h3>Constants</h3>
108
+ </header>
109
+ <dl>
110
+
111
+ <dt id="UTF8_MAP">UTF8_MAP
112
+
113
+ <dd><p>Map a piece identifier character with the corresponding UTF8 chess
114
+ character</p>
115
+
116
+
117
+ </dl>
118
+ </section>
119
+
120
+
121
+
122
+
123
+
124
+ <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
125
+ <header>
126
+ <h3>Public Instance Methods</h3>
127
+ </header>
128
+
129
+
130
+ <div id="method-i-to_utf8" class="method-detail ">
131
+
132
+ <div class="method-heading">
133
+ <span class="method-name">to_utf8</span><span
134
+ class="method-args">()</span>
135
+
136
+ <span class="method-click-advice">click to toggle source</span>
137
+
138
+ </div>
139
+
140
+
141
+ <div class="method-description">
142
+
143
+ <p>Replace the piece identifier characters with UTF8 chess characters</p>
144
+
145
+
146
+
147
+
148
+ <div class="method-source-code" id="to_utf8-source">
149
+ <pre><span class="ruby-comment"># File lib/chess/utf8_notation.rb, line 33</span>
150
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">to_utf8</span>
151
+ <span class="ruby-keyword">self</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">/[PRNBQKprnbqk]/</span>, <span class="ruby-constant">UTF8_MAP</span>)
152
+ <span class="ruby-keyword">end</span></pre>
153
+ </div>
154
+
155
+ </div>
156
+
157
+
158
+
159
+
160
+ </div>
161
+
162
+
163
+ </section>
164
+
165
+ </section>
166
+ </main>
167
+
168
+
169
+ <footer id="validator-badges" role="contentinfo">
170
+ <p><a href="http://validator.w3.org/check/referer">Validate</a>
171
+ <p>Generated by <a href="https://rdoc.github.io/rdoc">RDoc</a> 5.1.0.
172
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
173
+ </footer>
174
+