rook 0.0.2 → 0.1.0

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.
Files changed (87) hide show
  1. data/README.txt +124 -37
  2. data/bin/rook +8 -902
  3. data/doc-api/classes/BZ2.html +111 -0
  4. data/doc-api/classes/BZ2/Reader.html +234 -0
  5. data/doc-api/classes/Digest.html +107 -0
  6. data/doc-api/classes/Digest/Base.html +254 -0
  7. data/doc-api/classes/Enumerable.html +430 -0
  8. data/doc-api/classes/File.html +208 -0
  9. data/doc-api/classes/FileUtils.html +758 -0
  10. data/doc-api/classes/Kernel.html +317 -0
  11. data/doc-api/classes/Rook.html +148 -0
  12. data/doc-api/classes/Rook/Assertion.html +164 -0
  13. data/doc-api/classes/Rook/AssertionError.html +111 -0
  14. data/doc-api/classes/Rook/CommandOptionError.html +113 -0
  15. data/doc-api/classes/Rook/Commands.html +1158 -0
  16. data/doc-api/classes/Rook/Cookbook.html +357 -0
  17. data/doc-api/classes/Rook/CookbookError.html +161 -0
  18. data/doc-api/classes/Rook/CookbookValidator.html +215 -0
  19. data/doc-api/classes/Rook/Kitchen.html +875 -0
  20. data/doc-api/classes/Rook/KitchenHelper.html +386 -0
  21. data/doc-api/classes/Rook/Main.html +325 -0
  22. data/doc-api/classes/Rook/Parameters.html +443 -0
  23. data/doc-api/classes/Rook/Recipe.html +546 -0
  24. data/doc-api/classes/Rook/RookError.html +111 -0
  25. data/doc-api/classes/Rook/Util.html +408 -0
  26. data/doc-api/classes/Rook/Util/UndefinedPropertyError.html +160 -0
  27. data/doc-api/created.rid +1 -0
  28. data/doc-api/files/__/README_txt.html +313 -0
  29. data/doc-api/files/rook/commands_rb.html +115 -0
  30. data/doc-api/files/rook/cookbook_rb.html +115 -0
  31. data/doc-api/files/rook/helper/bz2_rb.html +114 -0
  32. data/doc-api/files/rook/helper/digest_rb.html +114 -0
  33. data/doc-api/files/rook/helper/enumerable_rb.html +107 -0
  34. data/doc-api/files/rook/helper/file_rb.html +107 -0
  35. data/doc-api/files/rook/helper/fileutils_rb.html +124 -0
  36. data/doc-api/files/rook/helper/kernel_rb.html +107 -0
  37. data/doc-api/files/rook/kitchen_rb.html +117 -0
  38. data/doc-api/files/rook/main_rb.html +117 -0
  39. data/doc-api/files/rook/recipe_rb.html +114 -0
  40. data/doc-api/files/rook/util_rb.html +115 -0
  41. data/doc-api/files/rook_rb.html +122 -0
  42. data/doc-api/fr_class_index.html +50 -0
  43. data/doc-api/fr_file_index.html +40 -0
  44. data/doc-api/fr_method_index.html +181 -0
  45. data/doc-api/index.html +24 -0
  46. data/doc-api/rdoc-style.css +208 -0
  47. data/examples/hello_c/Rookbook.rb +37 -0
  48. data/examples/hello_c/Rookbook.yaml +45 -0
  49. data/examples/hello_c/hello.c +6 -3
  50. data/examples/project/README.txt +8 -0
  51. data/examples/project/Rookbook.props +1 -0
  52. data/examples/project/Rookbook.rb +120 -0
  53. data/examples/project/Rookbook.yaml +117 -0
  54. data/examples/project/bin/example +12 -0
  55. data/examples/project/example.gemspec +29 -0
  56. data/examples/project/lib/example.rb +36 -0
  57. data/examples/{archive → project}/lib/example/bar.rb +0 -0
  58. data/examples/{archive → project}/lib/example/baz.rb +0 -0
  59. data/examples/{archive → project}/lib/example/foo.rb +0 -0
  60. data/examples/project/setup.rb +1331 -0
  61. data/examples/project/test/test.rb +27 -0
  62. data/lib/rook.rb +50 -0
  63. data/lib/rook/commands.rb +426 -0
  64. data/lib/rook/cookbook.rb +237 -0
  65. data/lib/rook/helper/bz2.rb +39 -0
  66. data/lib/rook/helper/digest.rb +76 -0
  67. data/lib/rook/helper/enumerable.rb +121 -0
  68. data/lib/rook/helper/file.rb +50 -0
  69. data/lib/rook/helper/fileutils.rb +340 -0
  70. data/lib/rook/helper/kernel.rb +108 -0
  71. data/lib/rook/kitchen.rb +668 -0
  72. data/lib/rook/main.rb +280 -0
  73. data/lib/rook/recipe.rb +259 -0
  74. data/lib/rook/rookbook.schema.yaml +156 -0
  75. data/lib/rook/util.rb +172 -0
  76. data/rook.gemspec +56 -0
  77. metadata +139 -45
  78. data/examples/archive/COPYING +0 -340
  79. data/examples/archive/README.txt +0 -1
  80. data/examples/archive/Rookbook +0 -56
  81. data/examples/archive/bin/example +0 -0
  82. data/examples/archive/doc/index.html +0 -0
  83. data/examples/archive/doc/index.txt +0 -0
  84. data/examples/archive/lib/example.rb +0 -0
  85. data/examples/archive/test/test1.rb +0 -0
  86. data/examples/archive/test/test2.rb +0 -0
  87. data/examples/hello_c/Rookbook +0 -24
@@ -0,0 +1,254 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Class: Digest::Base</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">Digest::Base</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/rook/helper/digest_rb.html">
59
+ rook/helper/digest.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ Object
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </div>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+
77
+
78
+
79
+ <div id="contextContent">
80
+
81
+
82
+
83
+ </div>
84
+
85
+ <div id="method-list">
86
+ <h3 class="section-bar">Methods</h3>
87
+
88
+ <div class="name-list">
89
+ <a href="#M000153">create_from_file</a>&nbsp;&nbsp;
90
+ <a href="#M000155">file_digest</a>&nbsp;&nbsp;
91
+ <a href="#M000154">file_hexdigest</a>&nbsp;&nbsp;
92
+ </div>
93
+ </div>
94
+
95
+ </div>
96
+
97
+
98
+ <!-- if includes -->
99
+
100
+ <div id="section">
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+
109
+ <!-- if method_list -->
110
+ <div id="methods">
111
+ <h3 class="section-bar">Public Class methods</h3>
112
+
113
+ <div id="method-M000153" class="method-detail">
114
+ <a name="M000153"></a>
115
+
116
+ <div class="method-heading">
117
+ <a href="#M000153" class="method-signature">
118
+ <span class="method-name">create_from_file</span><span class="method-args">(filename)</span>
119
+ </a>
120
+ </div>
121
+
122
+ <div class="method-description">
123
+ <p>
124
+ create digest object from file content
125
+ </p>
126
+ <p>
127
+ ex.
128
+ </p>
129
+ <pre>
130
+ require 'digest/md5'
131
+ digest = Digest::MD5.create_from_file('largefile.mov')
132
+ puts digest.hexdigest
133
+ </pre>
134
+ <p>
135
+ this is faster than
136
+ &#8216;Digest::MD5.new(File.read(&quot;largefile.mov&quot;))&#8217; when
137
+ file size is large.
138
+ </p>
139
+ <p><a class="source-toggle" href="#"
140
+ onclick="toggleCode('M000153-source');return false;">[Source]</a></p>
141
+ <div class="method-source-code" id="M000153-source">
142
+ <pre>
143
+ <span class="ruby-comment cmt"># File rook/helper/digest.rb, line 26</span>
144
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">create_from_file</span>(<span class="ruby-identifier">filename</span>)
145
+ <span class="ruby-identifier">digest</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">new</span>
146
+ <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">filename</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
147
+ <span class="ruby-comment cmt">#size = 4 * 1024 # 4KB</span>
148
+ <span class="ruby-comment cmt">#size = 8 * 1024 # 8KB</span>
149
+ <span class="ruby-identifier">size</span> = <span class="ruby-value">16</span> <span class="ruby-operator">*</span> <span class="ruby-value">1024</span> <span class="ruby-comment cmt"># 16KB</span>
150
+ <span class="ruby-comment cmt">#size = 32 * 1024 # 32KB</span>
151
+ <span class="ruby-comment cmt">#size = 64 * 1024 # 64KB</span>
152
+ <span class="ruby-comment cmt">#size = 128 * 1024 # 128KB</span>
153
+ <span class="ruby-comment cmt">#size = 256 * 1024 # 256KB</span>
154
+ <span class="ruby-comment cmt">#size = 512 * 1024 # 512KB</span>
155
+ <span class="ruby-comment cmt">#size = 1 * 1024 * 1024 # 1MB</span>
156
+ <span class="ruby-comment cmt">#size = 4 * 1024 * 1024 # 4MB</span>
157
+ <span class="ruby-identifier">buf</span> = <span class="ruby-value str">''</span>
158
+ <span class="ruby-identifier">digest</span>.<span class="ruby-identifier">update</span>(<span class="ruby-identifier">buf</span>) <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">size</span>, <span class="ruby-identifier">buf</span>)
159
+ <span class="ruby-keyword kw">end</span>
160
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">digest</span>
161
+ <span class="ruby-keyword kw">end</span>
162
+ </pre>
163
+ </div>
164
+ </div>
165
+ </div>
166
+
167
+ <div id="method-M000155" class="method-detail">
168
+ <a name="M000155"></a>
169
+
170
+ <div class="method-heading">
171
+ <a href="#M000155" class="method-signature">
172
+ <span class="method-name">file_digest</span><span class="method-args">(filename)</span>
173
+ </a>
174
+ </div>
175
+
176
+ <div class="method-description">
177
+ <p>
178
+ return digest value of file content
179
+ </p>
180
+ <p>
181
+ ex.
182
+ </p>
183
+ <pre>
184
+ require 'digest/md5'
185
+ puts Digest::MD5.digest('largefile.mov')
186
+ </pre>
187
+ <p>
188
+ this is faster than &#8216;Digest::MD5.digest(File.read(filename))&#8217;
189
+ when file size is large.
190
+ </p>
191
+ <p><a class="source-toggle" href="#"
192
+ onclick="toggleCode('M000155-source');return false;">[Source]</a></p>
193
+ <div class="method-source-code" id="M000155-source">
194
+ <pre>
195
+ <span class="ruby-comment cmt"># File rook/helper/digest.rb, line 71</span>
196
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">file_digest</span>(<span class="ruby-identifier">filename</span>)
197
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">create_from_file</span>(<span class="ruby-identifier">filename</span>).<span class="ruby-identifier">digest</span>
198
+ <span class="ruby-keyword kw">end</span>
199
+ </pre>
200
+ </div>
201
+ </div>
202
+ </div>
203
+
204
+ <div id="method-M000154" class="method-detail">
205
+ <a name="M000154"></a>
206
+
207
+ <div class="method-heading">
208
+ <a href="#M000154" class="method-signature">
209
+ <span class="method-name">file_hexdigest</span><span class="method-args">(filename)</span>
210
+ </a>
211
+ </div>
212
+
213
+ <div class="method-description">
214
+ <p>
215
+ return hex-digest value of file content
216
+ </p>
217
+ <p>
218
+ ex.
219
+ </p>
220
+ <pre>
221
+ require 'digest/md5'
222
+ puts Digest::MD5.hex_digest('largefile.mov')
223
+ </pre>
224
+ <p>
225
+ this is faster than
226
+ &#8216;Digest::MD5.hex_digest(File.read(filename))&#8217; when file size is
227
+ large.
228
+ </p>
229
+ <p><a class="source-toggle" href="#"
230
+ onclick="toggleCode('M000154-source');return false;">[Source]</a></p>
231
+ <div class="method-source-code" id="M000154-source">
232
+ <pre>
233
+ <span class="ruby-comment cmt"># File rook/helper/digest.rb, line 56</span>
234
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">file_hexdigest</span>(<span class="ruby-identifier">filename</span>)
235
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">create_from_file</span>(<span class="ruby-identifier">filename</span>).<span class="ruby-identifier">hexdigest</span>
236
+ <span class="ruby-keyword kw">end</span>
237
+ </pre>
238
+ </div>
239
+ </div>
240
+ </div>
241
+
242
+
243
+ </div>
244
+
245
+
246
+ </div>
247
+
248
+
249
+ <div id="validator-badges">
250
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
251
+ </div>
252
+
253
+ </body>
254
+ </html>
@@ -0,0 +1,430 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Module: Enumerable</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Module</strong></td>
53
+ <td class="class-name-in-header">Enumerable</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/rook/helper/enumerable_rb.html">
59
+ rook/helper/enumerable.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ </table>
66
+ </div>
67
+ <!-- banner header -->
68
+
69
+ <div id="bodyContent">
70
+
71
+
72
+
73
+ <div id="contextContent">
74
+
75
+ <div id="description">
76
+ <p>
77
+ $Rev: 20 $ $Release: 0.1.0 $ copyright(c) 2006 kuwata-lab.com all rights reserved.
78
+ </p>
79
+
80
+ </div>
81
+
82
+
83
+ </div>
84
+
85
+ <div id="method-list">
86
+ <h3 class="section-bar">Methods</h3>
87
+
88
+ <div class="name-list">
89
+ <a href="#M000145">add_prefix</a>&nbsp;&nbsp;
90
+ <a href="#M000146">add_suffix</a>&nbsp;&nbsp;
91
+ <a href="#M000144">apply</a>&nbsp;&nbsp;
92
+ <a href="#M000151">basenames</a>&nbsp;&nbsp;
93
+ <a href="#M000150">delete_suffix</a>&nbsp;&nbsp;
94
+ <a href="#M000152">dirnames</a>&nbsp;&nbsp;
95
+ <a href="#M000149">each_gsub</a>&nbsp;&nbsp;
96
+ <a href="#M000148">each_sub</a>&nbsp;&nbsp;
97
+ <a href="#M000147">sandwich</a>&nbsp;&nbsp;
98
+ </div>
99
+ </div>
100
+
101
+ </div>
102
+
103
+
104
+ <!-- if includes -->
105
+
106
+ <div id="section">
107
+
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+ <!-- if method_list -->
116
+ <div id="methods">
117
+ <h3 class="section-bar">Public Instance methods</h3>
118
+
119
+ <div id="method-M000145" class="method-detail">
120
+ <a name="M000145"></a>
121
+
122
+ <div class="method-heading">
123
+ <a href="#M000145" class="method-signature">
124
+ <span class="method-name">add_prefix</span><span class="method-args">(prefix)</span>
125
+ </a>
126
+ </div>
127
+
128
+ <div class="method-description">
129
+ <p>
130
+ add prefix for each item
131
+ </p>
132
+ <p>
133
+ ex.
134
+ </p>
135
+ <pre>
136
+ ['a', 'b', 'c'].add_prefix('dir/') #=&gt; [&quot;dir/a&quot;, &quot;dir/b&quot;, &quot;dir/c&quot;]
137
+ </pre>
138
+ <p><a class="source-toggle" href="#"
139
+ onclick="toggleCode('M000145-source');return false;">[Source]</a></p>
140
+ <div class="method-source-code" id="M000145-source">
141
+ <pre>
142
+ <span class="ruby-comment cmt"># File rook/helper/enumerable.rb, line 28</span>
143
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_prefix</span>(<span class="ruby-identifier">prefix</span>)
144
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span> <span class="ruby-node">&quot;#{prefix}#{item}&quot;</span> }
145
+ <span class="ruby-keyword kw">end</span>
146
+ </pre>
147
+ </div>
148
+ </div>
149
+ </div>
150
+
151
+ <div id="method-M000146" class="method-detail">
152
+ <a name="M000146"></a>
153
+
154
+ <div class="method-heading">
155
+ <a href="#M000146" class="method-signature">
156
+ <span class="method-name">add_suffix</span><span class="method-args">(suffix)</span>
157
+ </a>
158
+ </div>
159
+
160
+ <div class="method-description">
161
+ <p>
162
+ add suffix for each item
163
+ </p>
164
+ <p>
165
+ ex.
166
+ </p>
167
+ <pre>
168
+ ['a', 'b', 'c'].add_suffix('.txt') #=&gt; [&quot;a.txt&quot;, &quot;b.txt&quot;, &quot;c.txt&quot;]
169
+ </pre>
170
+ <p><a class="source-toggle" href="#"
171
+ onclick="toggleCode('M000146-source');return false;">[Source]</a></p>
172
+ <div class="method-source-code" id="M000146-source">
173
+ <pre>
174
+ <span class="ruby-comment cmt"># File rook/helper/enumerable.rb, line 39</span>
175
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_suffix</span>(<span class="ruby-identifier">suffix</span>)
176
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span> <span class="ruby-node">&quot;#{item}#{suffix}&quot;</span> }
177
+ <span class="ruby-keyword kw">end</span>
178
+ </pre>
179
+ </div>
180
+ </div>
181
+ </div>
182
+
183
+ <div id="method-M000144" class="method-detail">
184
+ <a name="M000144"></a>
185
+
186
+ <div class="method-heading">
187
+ <a href="#M000144" class="method-signature">
188
+ <span class="method-name">apply</span><span class="method-args">(method_name, *args)</span>
189
+ </a>
190
+ </div>
191
+
192
+ <div class="method-description">
193
+ <p>
194
+ apply method with args
195
+ </p>
196
+ <p>
197
+ ex.
198
+ </p>
199
+ <pre>
200
+ [1, 2, 3].apply(:'+', 5) #=&gt; [6, 7, 8]
201
+ </pre>
202
+ <p><a class="source-toggle" href="#"
203
+ onclick="toggleCode('M000144-source');return false;">[Source]</a></p>
204
+ <div class="method-source-code" id="M000144-source">
205
+ <pre>
206
+ <span class="ruby-comment cmt"># File rook/helper/enumerable.rb, line 17</span>
207
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">apply</span>(<span class="ruby-identifier">method_name</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
208
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span> <span class="ruby-identifier">item</span>.<span class="ruby-identifier">__send__</span>(<span class="ruby-identifier">method_name</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>) }
209
+ <span class="ruby-keyword kw">end</span>
210
+ </pre>
211
+ </div>
212
+ </div>
213
+ </div>
214
+
215
+ <div id="method-M000151" class="method-detail">
216
+ <a name="M000151"></a>
217
+
218
+ <div class="method-heading">
219
+ <a href="#M000151" class="method-signature">
220
+ <span class="method-name">basenames</span><span class="method-args">()</span>
221
+ </a>
222
+ </div>
223
+
224
+ <div class="method-description">
225
+ <p>
226
+ get basename of each item
227
+ </p>
228
+ <p>
229
+ ex.
230
+ </p>
231
+ <pre>
232
+ ['dir1/a.txt', 'b.txt'].basenames() #=&gt; ['a.txt', 'b.txt']
233
+ </pre>
234
+ <p><a class="source-toggle" href="#"
235
+ onclick="toggleCode('M000151-source');return false;">[Source]</a></p>
236
+ <div class="method-source-code" id="M000151-source">
237
+ <pre>
238
+ <span class="ruby-comment cmt"># File rook/helper/enumerable.rb, line 105</span>
239
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">basenames</span>
240
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-identifier">item</span>) }
241
+ <span class="ruby-keyword kw">end</span>
242
+ </pre>
243
+ </div>
244
+ </div>
245
+ </div>
246
+
247
+ <div id="method-M000150" class="method-detail">
248
+ <a name="M000150"></a>
249
+
250
+ <div class="method-heading">
251
+ <a href="#M000150" class="method-signature">
252
+ <span class="method-name">delete_suffix</span><span class="method-args">(suffix=/\.\w+\z/)</span>
253
+ </a>
254
+ </div>
255
+
256
+ <div class="method-description">
257
+ <p>
258
+ delete suffix for each item
259
+ </p>
260
+ <p>
261
+ ex.
262
+ </p>
263
+ <pre>
264
+ ['a.txt', 'b.txt'].delete_suffix() #=&gt; [&quot;a&quot;, &quot;b&quot;]
265
+ </pre>
266
+ <p><a class="source-toggle" href="#"
267
+ onclick="toggleCode('M000150-source');return false;">[Source]</a></p>
268
+ <div class="method-source-code" id="M000150-source">
269
+ <pre>
270
+ <span class="ruby-comment cmt"># File rook/helper/enumerable.rb, line 91</span>
271
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete_suffix</span>(<span class="ruby-identifier">suffix</span>=<span class="ruby-regexp re">/\.\w+\z/</span>)
272
+ <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">suffix</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Regexp</span>)
273
+ <span class="ruby-identifier">suffix</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">compile</span>(<span class="ruby-node">&quot;#{suffix.to_s}\\z&quot;</span>)
274
+ <span class="ruby-keyword kw">end</span>
275
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span> <span class="ruby-identifier">item</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-identifier">suffix</span>, <span class="ruby-value str">''</span>) }
276
+ <span class="ruby-keyword kw">end</span>
277
+ </pre>
278
+ </div>
279
+ </div>
280
+ </div>
281
+
282
+ <div id="method-M000152" class="method-detail">
283
+ <a name="M000152"></a>
284
+
285
+ <div class="method-heading">
286
+ <a href="#M000152" class="method-signature">
287
+ <span class="method-name">dirnames</span><span class="method-args">()</span>
288
+ </a>
289
+ </div>
290
+
291
+ <div class="method-description">
292
+ <p>
293
+ get dirname of each item
294
+ </p>
295
+ <p>
296
+ ex.
297
+ </p>
298
+ <pre>
299
+ ['dir1/a.txt', 'b.txt'].dirnames() #=&gt; ['dir1', '.']
300
+ </pre>
301
+ <p><a class="source-toggle" href="#"
302
+ onclick="toggleCode('M000152-source');return false;">[Source]</a></p>
303
+ <div class="method-source-code" id="M000152-source">
304
+ <pre>
305
+ <span class="ruby-comment cmt"># File rook/helper/enumerable.rb, line 116</span>
306
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dirnames</span>
307
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-identifier">item</span>) }
308
+ <span class="ruby-keyword kw">end</span>
309
+ </pre>
310
+ </div>
311
+ </div>
312
+ </div>
313
+
314
+ <div id="method-M000149" class="method-detail">
315
+ <a name="M000149"></a>
316
+
317
+ <div class="method-heading">
318
+ <a href="#M000149" class="method-signature">
319
+ <span class="method-name">each_gsub</span><span class="method-args">(pattern, replace, &amp;block)</span>
320
+ </a>
321
+ </div>
322
+
323
+ <div class="method-description">
324
+ <p>
325
+ apply &#8216;gsub()&#8217; method to each item
326
+ </p>
327
+ <p>
328
+ ex.
329
+ </p>
330
+ <pre>
331
+ ['a.txt', 'b.txt'].each_gsub(/\.txt$/, '.html') #=&gt; [&quot;a.html&quot;, &quot;b.html&quot;]
332
+ </pre>
333
+ <p><a class="source-toggle" href="#"
334
+ onclick="toggleCode('M000149-source');return false;">[Source]</a></p>
335
+ <div class="method-source-code" id="M000149-source">
336
+ <pre>
337
+ <span class="ruby-comment cmt"># File rook/helper/enumerable.rb, line 76</span>
338
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">each_gsub</span>(<span class="ruby-identifier">pattern</span>, <span class="ruby-identifier">replace</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
339
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">replace</span>
340
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span> <span class="ruby-identifier">item</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-identifier">pattern</span>, <span class="ruby-identifier">replace</span>) }
341
+ <span class="ruby-keyword kw">else</span>
342
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span> <span class="ruby-identifier">item</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-identifier">pattern</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) }
343
+ <span class="ruby-keyword kw">end</span>
344
+ <span class="ruby-keyword kw">end</span>
345
+ </pre>
346
+ </div>
347
+ </div>
348
+ </div>
349
+
350
+ <div id="method-M000148" class="method-detail">
351
+ <a name="M000148"></a>
352
+
353
+ <div class="method-heading">
354
+ <a href="#M000148" class="method-signature">
355
+ <span class="method-name">each_sub</span><span class="method-args">(pattern, replace, &amp;block)</span>
356
+ </a>
357
+ </div>
358
+
359
+ <div class="method-description">
360
+ <p>
361
+ apply &#8216;sub()&#8217; method to each item
362
+ </p>
363
+ <p>
364
+ ex.
365
+ </p>
366
+ <pre>
367
+ ['a.txt', 'b.txt'].each_sub(/\.txt$/, '.html') #=&gt; [&quot;a.html&quot;, &quot;b.html&quot;]
368
+ </pre>
369
+ <p><a class="source-toggle" href="#"
370
+ onclick="toggleCode('M000148-source');return false;">[Source]</a></p>
371
+ <div class="method-source-code" id="M000148-source">
372
+ <pre>
373
+ <span class="ruby-comment cmt"># File rook/helper/enumerable.rb, line 61</span>
374
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">each_sub</span>(<span class="ruby-identifier">pattern</span>, <span class="ruby-identifier">replace</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
375
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">replace</span>
376
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span> <span class="ruby-identifier">item</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-identifier">pattern</span>, <span class="ruby-identifier">replace</span>) }
377
+ <span class="ruby-keyword kw">else</span>
378
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span> <span class="ruby-identifier">item</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-identifier">pattern</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) }
379
+ <span class="ruby-keyword kw">end</span>
380
+ <span class="ruby-keyword kw">end</span>
381
+ </pre>
382
+ </div>
383
+ </div>
384
+ </div>
385
+
386
+ <div id="method-M000147" class="method-detail">
387
+ <a name="M000147"></a>
388
+
389
+ <div class="method-heading">
390
+ <a href="#M000147" class="method-signature">
391
+ <span class="method-name">sandwich</span><span class="method-args">(prefix, suffix)</span>
392
+ </a>
393
+ </div>
394
+
395
+ <div class="method-description">
396
+ <p>
397
+ add prefix and suffix for each item
398
+ </p>
399
+ <p>
400
+ ex.
401
+ </p>
402
+ <pre>
403
+ ['a','b','c'].sandwich('p/', '.s') #=&gt; [&quot;p/a.s&quot;, &quot;p/b.s&quot;, &quot;p/c.s&quot;]
404
+ </pre>
405
+ <p><a class="source-toggle" href="#"
406
+ onclick="toggleCode('M000147-source');return false;">[Source]</a></p>
407
+ <div class="method-source-code" id="M000147-source">
408
+ <pre>
409
+ <span class="ruby-comment cmt"># File rook/helper/enumerable.rb, line 50</span>
410
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sandwich</span>(<span class="ruby-identifier">prefix</span>, <span class="ruby-identifier">suffix</span>)
411
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span> <span class="ruby-node">&quot;#{prefix}#{item}#{suffix}&quot;</span> }
412
+ <span class="ruby-keyword kw">end</span>
413
+ </pre>
414
+ </div>
415
+ </div>
416
+ </div>
417
+
418
+
419
+ </div>
420
+
421
+
422
+ </div>
423
+
424
+
425
+ <div id="validator-badges">
426
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
427
+ </div>
428
+
429
+ </body>
430
+ </html>