simple2ch 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +17 -20
- data/UPDATES.md +11 -0
- data/doc/Simple2ch/Board.html +1 -1
- data/doc/Simple2ch/Dat.html +11 -7
- data/doc/Simple2ch/DatParseException.html +1 -1
- data/doc/Simple2ch/KakoLogException.html +1 -1
- data/doc/Simple2ch/NoThreGivenException.html +131 -0
- data/doc/Simple2ch/NotA2chUrlException.html +1 -1
- data/doc/Simple2ch/Res.html +158 -24
- data/doc/Simple2ch/Simple2chException.html +2 -2
- data/doc/Simple2ch/Thre.html +143 -19
- data/doc/Simple2ch.html +3 -3
- data/doc/_index.html +8 -1
- data/doc/class_list.html +1 -1
- data/doc/file.README.html +5 -6
- data/doc/index.html +5 -6
- data/doc/method_list.html +20 -8
- data/doc/top-level-namespace.html +1 -1
- data/lib/simple2ch/dat.rb +9 -9
- data/lib/simple2ch/res.rb +27 -4
- data/lib/simple2ch/simple2ch_exception.rb +1 -0
- data/lib/simple2ch/thre.rb +33 -5
- data/lib/simple2ch/version.rb +1 -1
- data/spec/dat_spec.rb +2 -1
- data/spec/res_spec.rb +19 -4
- data/spec/thre_spec.rb +28 -5
- metadata +3 -2
data/doc/Simple2ch/Thre.html
CHANGED
@@ -321,7 +321,31 @@
|
|
321
321
|
<li class="public ">
|
322
322
|
<span class="summary_signature">
|
323
323
|
|
324
|
-
<a href="#
|
324
|
+
<a href="#received_anchors-instance_method" title="#received_anchors (instance method)">- (Hash) <strong>received_anchors</strong> </a>
|
325
|
+
|
326
|
+
|
327
|
+
|
328
|
+
</span>
|
329
|
+
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
|
334
|
+
|
335
|
+
|
336
|
+
|
337
|
+
|
338
|
+
<span class="summary_desc"><div class='inline'>
|
339
|
+
<p>全てのレスに対し、あるレスへのアンカーが書き込まれているレス番号のハッシュを返す.</p>
|
340
|
+
</div></span>
|
341
|
+
|
342
|
+
</li>
|
343
|
+
|
344
|
+
|
345
|
+
<li class="public ">
|
346
|
+
<span class="summary_signature">
|
347
|
+
|
348
|
+
<a href="#reses-instance_method" title="#reses (instance method)">- (Array<Res>) <strong>reses</strong>(num_of_reses = nil) </a>
|
325
349
|
|
326
350
|
|
327
351
|
|
@@ -449,7 +473,8 @@
|
|
449
473
|
20
|
450
474
|
21
|
451
475
|
22
|
452
|
-
23
|
476
|
+
23
|
477
|
+
24</pre>
|
453
478
|
</td>
|
454
479
|
<td>
|
455
480
|
<pre class="code"><span class="info file"># File 'lib/simple2ch/thre.rb', line 16</span>
|
@@ -461,6 +486,7 @@
|
|
461
486
|
<span class='ivar'>@num_of_response</span> <span class='op'>=</span> <span class='id identifier rubyid_num_of_response'>num_of_response</span>
|
462
487
|
<span class='ivar'>@reses</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
463
488
|
<span class='ivar'>@f_kako_log</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
489
|
+
<span class='ivar'>@received_anchors</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
464
490
|
<span class='kw'>end</span></pre>
|
465
491
|
</td>
|
466
492
|
</tr>
|
@@ -803,17 +829,17 @@
|
|
803
829
|
<pre class="lines">
|
804
830
|
|
805
831
|
|
806
|
-
29
|
807
832
|
30
|
808
833
|
31
|
809
834
|
32
|
810
835
|
33
|
811
836
|
34
|
812
837
|
35
|
813
|
-
36
|
838
|
+
36
|
839
|
+
37</pre>
|
814
840
|
</td>
|
815
841
|
<td>
|
816
|
-
<pre class="code"><span class="info file"># File 'lib/simple2ch/thre.rb', line
|
842
|
+
<pre class="code"><span class="info file"># File 'lib/simple2ch/thre.rb', line 30</span>
|
817
843
|
|
818
844
|
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_board'>board</span><span class='comma'>,</span> <span class='id identifier rubyid_thread_data'>thread_data</span><span class='rparen'>)</span>
|
819
845
|
<span class='id identifier rubyid_thread_data'>thread_data</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>(\d{10})\.dat<>(.+) \((\d+)\)</span><span class='regexp_end'>/</span></span>
|
@@ -878,15 +904,77 @@
|
|
878
904
|
<pre class="lines">
|
879
905
|
|
880
906
|
|
881
|
-
|
882
|
-
|
883
|
-
|
907
|
+
55
|
908
|
+
56
|
909
|
+
57
|
910
|
+
58</pre>
|
884
911
|
</td>
|
885
912
|
<td>
|
886
|
-
<pre class="code"><span class="info file"># File 'lib/simple2ch/thre.rb', line
|
913
|
+
<pre class="code"><span class="info file"># File 'lib/simple2ch/thre.rb', line 55</span>
|
887
914
|
|
888
915
|
<span class='kw'>def</span> <span class='id identifier rubyid_kako_log?'>kako_log?</span>
|
889
|
-
<span class='
|
916
|
+
<span class='id identifier rubyid_fetch_dat'>fetch_dat</span> <span class='kw'>if</span> <span class='ivar'>@f_kako_log</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
917
|
+
<span class='ivar'>@f_kako_log</span>
|
918
|
+
<span class='kw'>end</span></pre>
|
919
|
+
</td>
|
920
|
+
</tr>
|
921
|
+
</table>
|
922
|
+
</div>
|
923
|
+
|
924
|
+
<div class="method_details ">
|
925
|
+
<h3 class="signature " id="received_anchors-instance_method">
|
926
|
+
|
927
|
+
- (<tt>Hash</tt>) <strong>received_anchors</strong>
|
928
|
+
|
929
|
+
|
930
|
+
|
931
|
+
|
932
|
+
|
933
|
+
</h3><div class="docstring">
|
934
|
+
<div class="discussion">
|
935
|
+
|
936
|
+
<p>全てのレスに対し、あるレスへのアンカーが書き込まれているレス番号のハッシュを返す</p>
|
937
|
+
|
938
|
+
|
939
|
+
</div>
|
940
|
+
</div>
|
941
|
+
<div class="tags">
|
942
|
+
|
943
|
+
<p class="tag_title">Returns:</p>
|
944
|
+
<ul class="return">
|
945
|
+
|
946
|
+
<li>
|
947
|
+
|
948
|
+
|
949
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
950
|
+
|
951
|
+
|
952
|
+
|
953
|
+
—
|
954
|
+
<div class='inline'>
|
955
|
+
<p>{ res_num<Fixnum> => res_nums<Array<Fixnum>> }
|
956
|
+
レス番号のハッシュ</p>
|
957
|
+
</div>
|
958
|
+
|
959
|
+
</li>
|
960
|
+
|
961
|
+
</ul>
|
962
|
+
|
963
|
+
</div><table class="source_code">
|
964
|
+
<tr>
|
965
|
+
<td>
|
966
|
+
<pre class="lines">
|
967
|
+
|
968
|
+
|
969
|
+
62
|
970
|
+
63
|
971
|
+
64</pre>
|
972
|
+
</td>
|
973
|
+
<td>
|
974
|
+
<pre class="code"><span class="info file"># File 'lib/simple2ch/thre.rb', line 62</span>
|
975
|
+
|
976
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_received_anchors'>received_anchors</span>
|
977
|
+
<span class='ivar'>@received_anchors</span> <span class='op'>||=</span> <span class='id identifier rubyid_calc_received_anchors'>calc_received_anchors</span>
|
890
978
|
<span class='kw'>end</span></pre>
|
891
979
|
</td>
|
892
980
|
</tr>
|
@@ -896,7 +984,7 @@
|
|
896
984
|
<div class="method_details ">
|
897
985
|
<h3 class="signature " id="reses-instance_method">
|
898
986
|
|
899
|
-
- (<tt>Array<<span class='object_link'><a href="Res.html" title="Simple2ch::Res (class)">Res</a></span>></tt>) <strong>reses</strong>
|
987
|
+
- (<tt>Array<<span class='object_link'><a href="Res.html" title="Simple2ch::Res (class)">Res</a></span>></tt>) <strong>reses</strong>(num_of_reses = nil)
|
900
988
|
|
901
989
|
|
902
990
|
|
@@ -911,7 +999,29 @@
|
|
911
999
|
</div>
|
912
1000
|
</div>
|
913
1001
|
<div class="tags">
|
1002
|
+
<p class="tag_title">Parameters:</p>
|
1003
|
+
<ul class="param">
|
914
1004
|
|
1005
|
+
<li>
|
1006
|
+
|
1007
|
+
<span class='name'>num_of_reses</span>
|
1008
|
+
|
1009
|
+
|
1010
|
+
<span class='type'>(<tt>Array<Fixnum></tt>)</span>
|
1011
|
+
|
1012
|
+
|
1013
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
1014
|
+
|
1015
|
+
|
1016
|
+
—
|
1017
|
+
<div class='inline'>
|
1018
|
+
<p>取得したいレス番号</p>
|
1019
|
+
</div>
|
1020
|
+
|
1021
|
+
</li>
|
1022
|
+
|
1023
|
+
</ul>
|
1024
|
+
|
915
1025
|
<p class="tag_title">Returns:</p>
|
916
1026
|
<ul class="return">
|
917
1027
|
|
@@ -937,15 +1047,29 @@
|
|
937
1047
|
<pre class="lines">
|
938
1048
|
|
939
1049
|
|
940
|
-
|
941
|
-
|
942
|
-
|
1050
|
+
42
|
1051
|
+
43
|
1052
|
+
44
|
1053
|
+
45
|
1054
|
+
46
|
1055
|
+
47
|
1056
|
+
48
|
1057
|
+
49
|
1058
|
+
50
|
1059
|
+
51</pre>
|
943
1060
|
</td>
|
944
1061
|
<td>
|
945
|
-
<pre class="code"><span class="info file"># File 'lib/simple2ch/thre.rb', line
|
946
|
-
|
947
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_reses'>reses</span>
|
948
|
-
<span class='
|
1062
|
+
<pre class="code"><span class="info file"># File 'lib/simple2ch/thre.rb', line 42</span>
|
1063
|
+
|
1064
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_reses'>reses</span><span class='lparen'>(</span><span class='id identifier rubyid_num_of_reses'>num_of_reses</span><span class='op'>=</span><span class='kw'>nil</span><span class='rparen'>)</span>
|
1065
|
+
<span class='id identifier rubyid_fetch_dat'>fetch_dat</span> <span class='kw'>unless</span> <span class='ivar'>@reses</span>
|
1066
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_num_of_reses'>num_of_reses</span> <span class='op'>&&</span> <span class='id identifier rubyid_num_of_reses'>num_of_reses</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='op'>></span> <span class='int'>0</span>
|
1067
|
+
<span class='ivar'>@reses</span><span class='period'>.</span><span class='id identifier rubyid_find_all'>find_all</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_r'>r</span><span class='op'>|</span>
|
1068
|
+
<span class='id identifier rubyid_num_of_reses'>num_of_reses</span><span class='period'>.</span><span class='id identifier rubyid_index'>index</span><span class='lparen'>(</span><span class='id identifier rubyid_r'>r</span><span class='period'>.</span><span class='id identifier rubyid_res_num'>res_num</span><span class='rparen'>)</span>
|
1069
|
+
<span class='rbrace'>}</span>
|
1070
|
+
<span class='kw'>else</span>
|
1071
|
+
<span class='ivar'>@reses</span>
|
1072
|
+
<span class='kw'>end</span>
|
949
1073
|
<span class='kw'>end</span></pre>
|
950
1074
|
</td>
|
951
1075
|
</tr>
|
@@ -957,7 +1081,7 @@
|
|
957
1081
|
</div>
|
958
1082
|
|
959
1083
|
<div id="footer">
|
960
|
-
Generated on
|
1084
|
+
Generated on Tue Sep 16 11:23:33 2014 by
|
961
1085
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
962
1086
|
0.8.7.4 (ruby-2.1.2).
|
963
1087
|
</div>
|
data/doc/Simple2ch.html
CHANGED
@@ -92,7 +92,7 @@
|
|
92
92
|
|
93
93
|
|
94
94
|
|
95
|
-
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Simple2ch/Board.html" title="Simple2ch::Board (class)">Board</a></span>, <span class='object_link'><a href="Simple2ch/Dat.html" title="Simple2ch::Dat (class)">Dat</a></span>, <span class='object_link'><a href="Simple2ch/DatParseException.html" title="Simple2ch::DatParseException (class)">DatParseException</a></span>, <span class='object_link'><a href="Simple2ch/KakoLogException.html" title="Simple2ch::KakoLogException (class)">KakoLogException</a></span>, <span class='object_link'><a href="Simple2ch/NotA2chUrlException.html" title="Simple2ch::NotA2chUrlException (class)">NotA2chUrlException</a></span>, <span class='object_link'><a href="Simple2ch/Res.html" title="Simple2ch::Res (class)">Res</a></span>, <span class='object_link'><a href="Simple2ch/Simple2chException.html" title="Simple2ch::Simple2chException (class)">Simple2chException</a></span>, <span class='object_link'><a href="Simple2ch/Thre.html" title="Simple2ch::Thre (class)">Thre</a></span>
|
95
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Simple2ch/Board.html" title="Simple2ch::Board (class)">Board</a></span>, <span class='object_link'><a href="Simple2ch/Dat.html" title="Simple2ch::Dat (class)">Dat</a></span>, <span class='object_link'><a href="Simple2ch/DatParseException.html" title="Simple2ch::DatParseException (class)">DatParseException</a></span>, <span class='object_link'><a href="Simple2ch/KakoLogException.html" title="Simple2ch::KakoLogException (class)">KakoLogException</a></span>, <span class='object_link'><a href="Simple2ch/NoThreGivenException.html" title="Simple2ch::NoThreGivenException (class)">NoThreGivenException</a></span>, <span class='object_link'><a href="Simple2ch/NotA2chUrlException.html" title="Simple2ch::NotA2chUrlException (class)">NotA2chUrlException</a></span>, <span class='object_link'><a href="Simple2ch/Res.html" title="Simple2ch::Res (class)">Res</a></span>, <span class='object_link'><a href="Simple2ch/Simple2chException.html" title="Simple2ch::Simple2chException (class)">Simple2chException</a></span>, <span class='object_link'><a href="Simple2ch/Thre.html" title="Simple2ch::Thre (class)">Thre</a></span>
|
96
96
|
|
97
97
|
|
98
98
|
</p>
|
@@ -109,7 +109,7 @@
|
|
109
109
|
<dt id="VERSION-constant" class="">VERSION =
|
110
110
|
|
111
111
|
</dt>
|
112
|
-
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0.1.
|
112
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0.1.2</span><span class='tstring_end'>"</span></span></pre></dd>
|
113
113
|
|
114
114
|
</dl>
|
115
115
|
|
@@ -305,7 +305,7 @@
|
|
305
305
|
</div>
|
306
306
|
|
307
307
|
<div id="footer">
|
308
|
-
Generated on
|
308
|
+
Generated on Tue Sep 16 11:23:33 2014 by
|
309
309
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
310
310
|
0.8.7.4 (ruby-2.1.2).
|
311
311
|
</div>
|
data/doc/_index.html
CHANGED
@@ -136,6 +136,13 @@
|
|
136
136
|
<li class="letter">N</li>
|
137
137
|
<ul>
|
138
138
|
|
139
|
+
<li>
|
140
|
+
<span class='object_link'><a href="Simple2ch/NoThreGivenException.html" title="Simple2ch::NoThreGivenException (class)">NoThreGivenException</a></span>
|
141
|
+
|
142
|
+
<small>(Simple2ch)</small>
|
143
|
+
|
144
|
+
</li>
|
145
|
+
|
139
146
|
<li>
|
140
147
|
<span class='object_link'><a href="Simple2ch/NotA2chUrlException.html" title="Simple2ch::NotA2chUrlException (class)">NotA2chUrlException</a></span>
|
141
148
|
|
@@ -205,7 +212,7 @@
|
|
205
212
|
</div>
|
206
213
|
|
207
214
|
<div id="footer">
|
208
|
-
Generated on
|
215
|
+
Generated on Tue Sep 16 11:23:32 2014 by
|
209
216
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
210
217
|
0.8.7.4 (ruby-2.1.2).
|
211
218
|
</div>
|
data/doc/class_list.html
CHANGED
@@ -46,7 +46,7 @@
|
|
46
46
|
|
47
47
|
<ul id="full_list" class="class">
|
48
48
|
<li><span class='object_link'><a href="top-level-namespace.html" title="Top Level Namespace (root)">Top Level Namespace</a></span></li>
|
49
|
-
<li><a class='toggle'></a> <span class='object_link'><a href="Simple2ch.html" title="Simple2ch (module)">Simple2ch</a></span><small class='search_info'>Top Level Namespace</small></li><ul><li><span class='object_link'><a href="Simple2ch/Board.html" title="Simple2ch::Board (class)">Board</a></span> < Object<small class='search_info'>Simple2ch</small></li><li><span class='object_link'><a href="Simple2ch/Dat.html" title="Simple2ch::Dat (class)">Dat</a></span> < Object<small class='search_info'>Simple2ch</small></li><li><span class='object_link'><a href="Simple2ch/DatParseException.html" title="Simple2ch::DatParseException (class)">DatParseException</a></span> < Simple2chException<small class='search_info'>Simple2ch</small></li><li><span class='object_link'><a href="Simple2ch/KakoLogException.html" title="Simple2ch::KakoLogException (class)">KakoLogException</a></span> < Simple2chException<small class='search_info'>Simple2ch</small></li><li><span class='object_link'><a href="Simple2ch/NotA2chUrlException.html" title="Simple2ch::NotA2chUrlException (class)">NotA2chUrlException</a></span> < Simple2chException<small class='search_info'>Simple2ch</small></li><li><span class='object_link'><a href="Simple2ch/Res.html" title="Simple2ch::Res (class)">Res</a></span> < Object<small class='search_info'>Simple2ch</small></li><li><span class='object_link'><a href="Simple2ch/Simple2chException.html" title="Simple2ch::Simple2chException (class)">Simple2chException</a></span> < Exception<small class='search_info'>Simple2ch</small></li><li><span class='object_link'><a href="Simple2ch/Thre.html" title="Simple2ch::Thre (class)">Thre</a></span> < Object<small class='search_info'>Simple2ch</small></li></ul>
|
49
|
+
<li><a class='toggle'></a> <span class='object_link'><a href="Simple2ch.html" title="Simple2ch (module)">Simple2ch</a></span><small class='search_info'>Top Level Namespace</small></li><ul><li><span class='object_link'><a href="Simple2ch/Board.html" title="Simple2ch::Board (class)">Board</a></span> < Object<small class='search_info'>Simple2ch</small></li><li><span class='object_link'><a href="Simple2ch/Dat.html" title="Simple2ch::Dat (class)">Dat</a></span> < Object<small class='search_info'>Simple2ch</small></li><li><span class='object_link'><a href="Simple2ch/DatParseException.html" title="Simple2ch::DatParseException (class)">DatParseException</a></span> < Simple2chException<small class='search_info'>Simple2ch</small></li><li><span class='object_link'><a href="Simple2ch/KakoLogException.html" title="Simple2ch::KakoLogException (class)">KakoLogException</a></span> < Simple2chException<small class='search_info'>Simple2ch</small></li><li><span class='object_link'><a href="Simple2ch/NoThreGivenException.html" title="Simple2ch::NoThreGivenException (class)">NoThreGivenException</a></span> < Simple2chException<small class='search_info'>Simple2ch</small></li><li><span class='object_link'><a href="Simple2ch/NotA2chUrlException.html" title="Simple2ch::NotA2chUrlException (class)">NotA2chUrlException</a></span> < Simple2chException<small class='search_info'>Simple2ch</small></li><li><span class='object_link'><a href="Simple2ch/Res.html" title="Simple2ch::Res (class)">Res</a></span> < Object<small class='search_info'>Simple2ch</small></li><li><span class='object_link'><a href="Simple2ch/Simple2chException.html" title="Simple2ch::Simple2chException (class)">Simple2chException</a></span> < Exception<small class='search_info'>Simple2ch</small></li><li><span class='object_link'><a href="Simple2ch/Thre.html" title="Simple2ch::Thre (class)">Thre</a></span> < Object<small class='search_info'>Simple2ch</small></li></ul>
|
50
50
|
|
51
51
|
</ul>
|
52
52
|
</div>
|
data/doc/file.README.html
CHANGED
@@ -73,12 +73,11 @@ href="http://dogwood008.github.io/simple2ch/">リファレンス</a></p>
|
|
73
73
|
|
74
74
|
<h2 id="label-%E6%9B%B4%E6%96%B0%E5%86%85%E5%AE%B9">更新内容</h2>
|
75
75
|
|
76
|
-
<p>[v0.1.
|
77
|
-
|
78
|
-
その他微細な修正</p>
|
76
|
+
<p>[v0.1.2] * リファクタリングとデバッグ * メソッド修正 *
|
77
|
+
Thre#reses(Array<Fixnum>)で指定したレス番号のレスを取得 * Thre#resesは今まで通り使用可能</p>
|
79
78
|
|
80
|
-
<p>[v0.
|
81
|
-
|
79
|
+
<p>[v0.1.1] * メソッド追加 * Res#anchorsの追加 * レス中のアンカーを抽出する * 必要gemの追加 *
|
80
|
+
Charwidthを追加</p>
|
82
81
|
|
83
82
|
<h2 id="label-Installation">Installation</h2>
|
84
83
|
|
@@ -129,7 +128,7 @@ feature'</code>)</p>
|
|
129
128
|
</div></div>
|
130
129
|
|
131
130
|
<div id="footer">
|
132
|
-
Generated on
|
131
|
+
Generated on Tue Sep 16 11:23:33 2014 by
|
133
132
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
134
133
|
0.8.7.4 (ruby-2.1.2).
|
135
134
|
</div>
|
data/doc/index.html
CHANGED
@@ -73,12 +73,11 @@ href="http://dogwood008.github.io/simple2ch/">リファレンス</a></p>
|
|
73
73
|
|
74
74
|
<h2 id="label-%E6%9B%B4%E6%96%B0%E5%86%85%E5%AE%B9">更新内容</h2>
|
75
75
|
|
76
|
-
<p>[v0.1.
|
77
|
-
|
78
|
-
その他微細な修正</p>
|
76
|
+
<p>[v0.1.2] * リファクタリングとデバッグ * メソッド修正 *
|
77
|
+
Thre#reses(Array<Fixnum>)で指定したレス番号のレスを取得 * Thre#resesは今まで通り使用可能</p>
|
79
78
|
|
80
|
-
<p>[v0.
|
81
|
-
|
79
|
+
<p>[v0.1.1] * メソッド追加 * Res#anchorsの追加 * レス中のアンカーを抽出する * 必要gemの追加 *
|
80
|
+
Charwidthを追加</p>
|
82
81
|
|
83
82
|
<h2 id="label-Installation">Installation</h2>
|
84
83
|
|
@@ -129,7 +128,7 @@ feature'</code>)</p>
|
|
129
128
|
</div></div>
|
130
129
|
|
131
130
|
<div id="footer">
|
132
|
-
Generated on
|
131
|
+
Generated on Tue Sep 16 11:23:32 2014 by
|
133
132
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
134
133
|
0.8.7.4 (ruby-2.1.2).
|
135
134
|
</div>
|
data/doc/method_list.html
CHANGED
@@ -102,14 +102,14 @@
|
|
102
102
|
|
103
103
|
|
104
104
|
<li class="r2 ">
|
105
|
-
<span class='object_link'><a href="Simple2ch/
|
106
|
-
<small>Simple2ch::
|
105
|
+
<span class='object_link'><a href="Simple2ch/Thre.html#initialize-instance_method" title="Simple2ch::Thre#initialize (method)">#initialize</a></span>
|
106
|
+
<small>Simple2ch::Thre</small>
|
107
107
|
</li>
|
108
108
|
|
109
109
|
|
110
110
|
<li class="r1 ">
|
111
|
-
<span class='object_link'><a href="Simple2ch/
|
112
|
-
<small>Simple2ch::
|
111
|
+
<span class='object_link'><a href="Simple2ch/Dat.html#initialize-instance_method" title="Simple2ch::Dat#initialize (method)">#initialize</a></span>
|
112
|
+
<small>Simple2ch::Dat</small>
|
113
113
|
</li>
|
114
114
|
|
115
115
|
|
@@ -120,14 +120,14 @@
|
|
120
120
|
|
121
121
|
|
122
122
|
<li class="r1 ">
|
123
|
-
<span class='object_link'><a href="Simple2ch/
|
124
|
-
<small>Simple2ch::
|
123
|
+
<span class='object_link'><a href="Simple2ch/Thre.html#kako_log%3F-instance_method" title="Simple2ch::Thre#kako_log? (method)">#kako_log?</a></span>
|
124
|
+
<small>Simple2ch::Thre</small>
|
125
125
|
</li>
|
126
126
|
|
127
127
|
|
128
128
|
<li class="r2 ">
|
129
|
-
<span class='object_link'><a href="Simple2ch/
|
130
|
-
<small>Simple2ch::
|
129
|
+
<span class='object_link'><a href="Simple2ch/Dat.html#kako_log%3F-instance_method" title="Simple2ch::Dat#kako_log? (method)">#kako_log?</a></span>
|
130
|
+
<small>Simple2ch::Dat</small>
|
131
131
|
</li>
|
132
132
|
|
133
133
|
|
@@ -155,6 +155,18 @@
|
|
155
155
|
</li>
|
156
156
|
|
157
157
|
|
158
|
+
<li class="r1 ">
|
159
|
+
<span class='object_link'><a href="Simple2ch/Res.html#received_anchors-instance_method" title="Simple2ch::Res#received_anchors (method)">#received_anchors</a></span>
|
160
|
+
<small>Simple2ch::Res</small>
|
161
|
+
</li>
|
162
|
+
|
163
|
+
|
164
|
+
<li class="r2 ">
|
165
|
+
<span class='object_link'><a href="Simple2ch/Thre.html#received_anchors-instance_method" title="Simple2ch::Thre#received_anchors (method)">#received_anchors</a></span>
|
166
|
+
<small>Simple2ch::Thre</small>
|
167
|
+
</li>
|
168
|
+
|
169
|
+
|
158
170
|
<li class="r1 ">
|
159
171
|
<span class='object_link'><a href="Simple2ch/Res.html#res_num-instance_method" title="Simple2ch::Res#res_num (method)">#res_num</a></span>
|
160
172
|
<small>Simple2ch::Res</small>
|
@@ -103,7 +103,7 @@
|
|
103
103
|
</div>
|
104
104
|
|
105
105
|
<div id="footer">
|
106
|
-
Generated on
|
106
|
+
Generated on Tue Sep 16 11:23:33 2014 by
|
107
107
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
108
108
|
0.8.7.4 (ruby-2.1.2).
|
109
109
|
</div>
|
data/lib/simple2ch/dat.rb
CHANGED
@@ -15,13 +15,15 @@ module Simple2ch
|
|
15
15
|
# Datを解析して、レスを返す
|
16
16
|
# @return [Array<Res>] レス
|
17
17
|
def reses
|
18
|
-
@reses
|
18
|
+
parse_dat unless @reses
|
19
|
+
@reses
|
19
20
|
end
|
20
21
|
|
21
22
|
# Datを解析して過去ログかどうかを返す
|
22
23
|
# @return [Boolean] 過去ログか否か
|
23
24
|
def kako_log?
|
24
|
-
@f_kako_log
|
25
|
+
parse_dat if @f_kako_log.nil?
|
26
|
+
@f_kako_log
|
25
27
|
end
|
26
28
|
|
27
29
|
private
|
@@ -34,24 +36,22 @@ module Simple2ch
|
|
34
36
|
# datファイルを取得する
|
35
37
|
# @return [String] 取得したdatファイルの中身
|
36
38
|
def fetch_dat
|
37
|
-
@data
|
39
|
+
@data ||= Simple2ch.fetch(dat_url)
|
38
40
|
end
|
39
41
|
|
40
42
|
# datファイルを解析してResを作成する
|
41
|
-
# @return [Array<Res>] 全てのレス
|
42
43
|
def parse_dat
|
43
44
|
res_num = 0
|
44
|
-
|
45
|
-
f_kako_log = false
|
45
|
+
@reses = []
|
46
|
+
@f_kako_log = false
|
46
47
|
fetch_dat.each_line do |l|
|
47
48
|
res_num += 1
|
48
49
|
begin
|
49
|
-
|
50
|
+
@reses << Res.parse(res_num, l)
|
50
51
|
rescue KakoLogException
|
51
|
-
f_kako_log = true
|
52
|
+
@f_kako_log = true
|
52
53
|
end
|
53
54
|
end
|
54
|
-
return @reses=tmp, @f_kako_log=f_kako_log
|
55
55
|
end
|
56
56
|
end
|
57
57
|
end
|
data/lib/simple2ch/res.rb
CHANGED
@@ -12,6 +12,8 @@ module Simple2ch
|
|
12
12
|
attr_reader :mail
|
13
13
|
# @return [String] 内容
|
14
14
|
attr_reader :contents
|
15
|
+
# @attr_writer [Thre] thre スレッド
|
16
|
+
attr_writer :thre
|
15
17
|
|
16
18
|
KAKO_LOG_INFO = '過去ログ ★<><>[過去ログ]<><em>■ このスレッドは過去ログ倉庫に格納されています</em><>'
|
17
19
|
|
@@ -22,13 +24,14 @@ module Simple2ch
|
|
22
24
|
# @param [Time] date 書き込み日時
|
23
25
|
# @param [String] mail メール欄
|
24
26
|
# @param [String] contents 内容
|
25
|
-
def initialize(res_num, author: '', author_id: '', date: nil, mail: '', contents: '')
|
27
|
+
def initialize(res_num, author: '', author_id: '', date: nil, mail: '', contents: '', thre: nil)
|
26
28
|
@res_num = res_num
|
27
29
|
@author = author
|
28
30
|
@author_id = author_id
|
29
31
|
@date = date
|
30
32
|
@mail = mail
|
31
33
|
@contents = contents
|
34
|
+
@thre = thre
|
32
35
|
end
|
33
36
|
|
34
37
|
# Datの1行から各項目を分離して、Resオブジェクトを返す
|
@@ -36,9 +39,11 @@ module Simple2ch
|
|
36
39
|
# @param [String] contents datのデータ1行
|
37
40
|
# @return [Res] 新規Resオブジェクト
|
38
41
|
# @raise [KakoLogException] 過去ログ情報をパースしようとした際に発生
|
39
|
-
def self.parse(res_num, contents)
|
42
|
+
def self.parse(res_num, contents, thre=nil)
|
40
43
|
unless contents.strip == KAKO_LOG_INFO
|
41
|
-
|
44
|
+
hash = parse_dat(contents)
|
45
|
+
hash[:thre] = thre if thre
|
46
|
+
return self.new(res_num, hash)
|
42
47
|
else
|
43
48
|
raise KakoLogException
|
44
49
|
end
|
@@ -68,7 +73,25 @@ module Simple2ch
|
|
68
73
|
end
|
69
74
|
end
|
70
75
|
|
76
|
+
# 自レスへのアンカーが書き込まれているレス番号を返す
|
77
|
+
# @return Array<Fixnum> レス番号
|
78
|
+
def received_anchors
|
79
|
+
thre = get_thre
|
80
|
+
received_anchors = thre.received_anchors
|
81
|
+
received_anchors.fetch(@res_num, [])
|
82
|
+
end
|
83
|
+
|
71
84
|
private
|
85
|
+
# スレッドを取得する
|
86
|
+
# @return [Thre] スレッド
|
87
|
+
def get_thre
|
88
|
+
if @thre
|
89
|
+
@thre
|
90
|
+
else
|
91
|
+
raise NoThreGivenException
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
72
95
|
# 全角数字をFixnumへ変換する
|
73
96
|
# @param [String] strnum 全角数字
|
74
97
|
# @return [Fixnum] 数字
|
@@ -86,7 +109,7 @@ module Simple2ch
|
|
86
109
|
ret[:author] = split[0]
|
87
110
|
ret[:mail] = split[1]
|
88
111
|
date_and_author_id = split[2]
|
89
|
-
ret[:contents] = split[3].strip
|
112
|
+
ret[:contents] = split[3].strip
|
90
113
|
|
91
114
|
date_and_author_id =~ split_date_and_id_regex
|
92
115
|
if !$1 || !$2
|
data/lib/simple2ch/thre.rb
CHANGED
@@ -20,6 +20,7 @@ module Simple2ch
|
|
20
20
|
@num_of_response = num_of_response
|
21
21
|
@reses = nil
|
22
22
|
@f_kako_log = nil
|
23
|
+
@received_anchors = nil
|
23
24
|
end
|
24
25
|
|
25
26
|
# 板オブジェクトとsubject.txtの1行データを渡すとスレオブジェクトを返す
|
@@ -36,26 +37,53 @@ module Simple2ch
|
|
36
37
|
end
|
37
38
|
|
38
39
|
# Datを解析して、レスを返す
|
40
|
+
# @param [Array<Fixnum>] num_of_reses 取得したいレス番号
|
39
41
|
# @return [Array<Res>] レスの配列
|
40
|
-
def reses
|
41
|
-
@reses
|
42
|
+
def reses(num_of_reses=nil)
|
43
|
+
fetch_dat unless @reses
|
44
|
+
if num_of_reses && num_of_reses.size > 0
|
45
|
+
@reses.find_all{|r|
|
46
|
+
num_of_reses.index(r.res_num)
|
47
|
+
}
|
48
|
+
else
|
49
|
+
@reses
|
50
|
+
end
|
42
51
|
end
|
43
52
|
|
44
53
|
# 過去ログかどうかを返す
|
45
54
|
# @return [Boolean] 過去ログか否か
|
46
55
|
def kako_log?
|
47
|
-
@f_kako_log
|
56
|
+
fetch_dat if @f_kako_log.nil?
|
57
|
+
@f_kako_log
|
58
|
+
end
|
59
|
+
|
60
|
+
# 全てのレスに対し、あるレスへのアンカーが書き込まれているレス番号のハッシュを返す
|
61
|
+
# @return [Hash]{ res_num<Fixnum> => res_nums<Array<Fixnum>> } レス番号のハッシュ
|
62
|
+
def received_anchors
|
63
|
+
@received_anchors ||= calc_received_anchors
|
48
64
|
end
|
49
65
|
|
50
66
|
private
|
67
|
+
# 全てのレスに対し、あるレスへのアンカーが書き込まれているレス番号のハッシュを返す
|
68
|
+
# @return [Hash]{ res_num<Fixnum> => res_nums<Array<Fixnum>> } レス番号のハッシュ
|
69
|
+
def calc_received_anchors
|
70
|
+
ret = {}
|
71
|
+
reses.each do |res|
|
72
|
+
res.anchors.each do |anchor|
|
73
|
+
ret.store(anchor, ret.fetch(anchor, []).push(res.res_num))
|
74
|
+
end
|
75
|
+
end
|
76
|
+
ret
|
77
|
+
end
|
78
|
+
|
79
|
+
|
51
80
|
# Datを取ってきてレスと過去ログかどうかを返す
|
52
|
-
# @return [Array<Res>] reses レス
|
53
81
|
# @return [Boolean] f_kako_log 過去ログか否か
|
54
82
|
def fetch_dat
|
55
83
|
dat = Dat.new(self)
|
56
84
|
@reses, @f_kako_log = dat.reses, dat.kako_log?
|
57
85
|
dat = nil
|
58
|
-
|
86
|
+
@f_kako_log
|
59
87
|
end
|
60
88
|
end
|
61
89
|
end
|
data/lib/simple2ch/version.rb
CHANGED
data/spec/dat_spec.rb
CHANGED
@@ -17,7 +17,8 @@ describe Simple2ch::Dat do
|
|
17
17
|
context 'should have reses' do
|
18
18
|
subject { dat.reses }
|
19
19
|
it { is_expected.to be_a_kind_of(Array) }
|
20
|
-
its(:size) { is_expected.to be
|
20
|
+
its(:size) { is_expected.to be == 144 }
|
21
|
+
it { expect(dat.kako_log?).to be == true }
|
21
22
|
it do
|
22
23
|
subject.each do |r|
|
23
24
|
expect(r).to be_a_kind_of(Simple2ch::Res)
|