marked-conductor 1.0.17 → 1.0.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +20 -0
  3. data/README.md +2 -0
  4. data/lib/conductor/config.rb +24 -24
  5. data/lib/conductor/filter.rb +49 -23
  6. data/lib/conductor/version.rb +1 -1
  7. data/src/_README.md +2 -0
  8. metadata +1 -62
  9. data/html/Array.html +0 -160
  10. data/html/Conductor/Command.html +0 -271
  11. data/html/Conductor/Condition.html +0 -791
  12. data/html/Conductor/Config.html +0 -170
  13. data/html/Conductor/Env.html +0 -220
  14. data/html/Conductor/Script.html +0 -288
  15. data/html/Conductor.html +0 -363
  16. data/html/FalseClass.html +0 -138
  17. data/html/Filter.html +0 -269
  18. data/html/Hash.html +0 -160
  19. data/html/Object.html +0 -138
  20. data/html/README_rdoc.html +0 -86
  21. data/html/String.html +0 -1409
  22. data/html/TrueClass.html +0 -138
  23. data/html/YuiCompressor/Yui.html +0 -447
  24. data/html/YuiCompressor.html +0 -93
  25. data/html/created.rid +0 -16
  26. data/html/css/fonts.css +0 -167
  27. data/html/css/rdoc.css +0 -687
  28. data/html/fonts/Lato-Light.ttf +0 -0
  29. data/html/fonts/Lato-LightItalic.ttf +0 -0
  30. data/html/fonts/Lato-Regular.ttf +0 -0
  31. data/html/fonts/Lato-RegularItalic.ttf +0 -0
  32. data/html/fonts/SourceCodePro-Bold.ttf +0 -0
  33. data/html/fonts/SourceCodePro-Regular.ttf +0 -0
  34. data/html/images/add.png +0 -0
  35. data/html/images/arrow_up.png +0 -0
  36. data/html/images/brick.png +0 -0
  37. data/html/images/brick_link.png +0 -0
  38. data/html/images/bug.png +0 -0
  39. data/html/images/bullet_black.png +0 -0
  40. data/html/images/bullet_toggle_minus.png +0 -0
  41. data/html/images/bullet_toggle_plus.png +0 -0
  42. data/html/images/date.png +0 -0
  43. data/html/images/delete.png +0 -0
  44. data/html/images/find.png +0 -0
  45. data/html/images/loadingAnimation.gif +0 -0
  46. data/html/images/macFFBgHack.png +0 -0
  47. data/html/images/package.png +0 -0
  48. data/html/images/page_green.png +0 -0
  49. data/html/images/page_white_text.png +0 -0
  50. data/html/images/page_white_width.png +0 -0
  51. data/html/images/plugin.png +0 -0
  52. data/html/images/ruby.png +0 -0
  53. data/html/images/tag_blue.png +0 -0
  54. data/html/images/tag_green.png +0 -0
  55. data/html/images/transparent.png +0 -0
  56. data/html/images/wrench.png +0 -0
  57. data/html/images/wrench_orange.png +0 -0
  58. data/html/images/zoom.png +0 -0
  59. data/html/index.html +0 -110
  60. data/html/js/darkfish.js +0 -97
  61. data/html/js/navigation.js +0 -105
  62. data/html/js/navigation.js.gz +0 -0
  63. data/html/js/search.js +0 -110
  64. data/html/js/search_index.js +0 -1
  65. data/html/js/search_index.js.gz +0 -0
  66. data/html/js/searcher.js +0 -229
  67. data/html/js/searcher.js.gz +0 -0
  68. data/html/table_of_contents.html +0 -539
  69. data/test.md +0 -14
data/html/String.html DELETED
@@ -1,1409 +0,0 @@
1
- <!DOCTYPE html>
2
-
3
- <html>
4
- <head>
5
- <meta charset="UTF-8">
6
-
7
- <title>class String - Marked Conductor</title>
8
-
9
- <script type="text/javascript">
10
- var rdoc_rel_prefix = "./";
11
- var index_rel_prefix = "./";
12
- </script>
13
-
14
- <script src="./js/navigation.js" defer></script>
15
- <script src="./js/search.js" defer></script>
16
- <script src="./js/search_index.js" defer></script>
17
- <script src="./js/searcher.js" defer></script>
18
- <script src="./js/darkfish.js" defer></script>
19
-
20
- <link href="./css/fonts.css" rel="stylesheet">
21
- <link href="./css/rdoc.css" rel="stylesheet">
22
-
23
-
24
- <body id="top" role="document" class="class">
25
- <nav role="navigation">
26
- <div id="project-navigation">
27
- <div id="home-section" role="region" title="Quick navigation" class="nav-section">
28
- <h2>
29
- <a href="./index.html" rel="home">Home</a>
30
- </h2>
31
-
32
- <div id="table-of-contents-navigation">
33
- <a href="./table_of_contents.html#pages">Pages</a>
34
- <a href="./table_of_contents.html#classes">Classes</a>
35
- <a href="./table_of_contents.html#methods">Methods</a>
36
- </div>
37
- </div>
38
-
39
- <div id="search-section" role="search" class="project-section initially-hidden">
40
- <form action="#" method="get" accept-charset="utf-8">
41
- <div id="search-field-wrapper">
42
- <input id="search-field" role="combobox" aria-label="Search"
43
- aria-autocomplete="list" aria-controls="search-results"
44
- type="text" name="search" placeholder="Search (/) for a class, method, ..." spellcheck="false"
45
- title="Type to search, Up and Down to navigate, Enter to load">
46
- </div>
47
-
48
- <ul id="search-results" aria-label="Search Results"
49
- aria-busy="false" aria-expanded="false"
50
- aria-atomic="false" class="initially-hidden"></ul>
51
- </form>
52
- </div>
53
-
54
- </div>
55
-
56
-
57
-
58
- <div id="class-metadata">
59
-
60
-
61
- <div id="parent-class-section" class="nav-section">
62
- <h3>Parent</h3>
63
-
64
- <p class="link"><a href="Object.html">Object</a>
65
- </div>
66
-
67
-
68
-
69
-
70
- <!-- Method Quickref -->
71
- <div id="method-list-section" class="nav-section">
72
- <h3>Methods</h3>
73
-
74
- <ul class="link-list" role="directory">
75
- <li ><a href="#method-i-add_comment">#add_comment</a>
76
- <li ><a href="#method-i-add_mmd">#add_mmd</a>
77
- <li ><a href="#method-i-add_yaml">#add_yaml</a>
78
- <li ><a href="#method-i-append">#append</a>
79
- <li ><a href="#method-i-autolink">#autolink</a>
80
- <li ><a href="#method-i-bool-3F">#bool?</a>
81
- <li ><a href="#method-i-bool_to_symbol">#bool_to_symbol</a>
82
- <li ><a href="#method-i-date-3F">#date?</a>
83
- <li ><a href="#method-i-delete_meta">#delete_meta</a>
84
- <li ><a href="#method-i-delete_mmd">#delete_mmd</a>
85
- <li ><a href="#method-i-delete_yaml">#delete_yaml</a>
86
- <li ><a href="#method-i-first_h1">#first_h1</a>
87
- <li ><a href="#method-i-first_h2">#first_h2</a>
88
- <li ><a href="#method-i-get_title">#get_title</a>
89
- <li ><a href="#method-i-has_comment-3F">#has_comment?</a>
90
- <li ><a href="#method-i-insert_css">#insert_css</a>
91
- <li ><a href="#method-i-insert_file">#insert_file</a>
92
- <li ><a href="#method-i-insert_script">#insert_script</a>
93
- <li ><a href="#method-i-insert_title">#insert_title</a>
94
- <li ><a href="#method-i-insert_toc">#insert_toc</a>
95
- <li ><a href="#method-i-meta-3F">#meta?</a>
96
- <li ><a href="#method-i-meta_insert_point">#meta_insert_point</a>
97
- <li ><a href="#method-i-meta_type">#meta_type</a>
98
- <li ><a href="#method-i-normalize_filter">#normalize_filter</a>
99
- <li ><a href="#method-i-normalize_include_type">#normalize_include_type</a>
100
- <li ><a href="#method-i-normalize_position">#normalize_position</a>
101
- <li ><a href="#method-i-number-3F">#number?</a>
102
- <li ><a href="#method-i-replace">#replace</a>
103
- <li ><a href="#method-i-replace_all">#replace_all</a>
104
- <li ><a href="#method-i-set_meta">#set_meta</a>
105
- <li ><a href="#method-i-strip_meta">#strip_meta</a>
106
- <li ><a href="#method-i-strip_time">#strip_time</a>
107
- <li ><a href="#method-i-time-3F">#time?</a>
108
- <li ><a href="#method-i-title_from_slug">#title_from_slug</a>
109
- <li ><a href="#method-i-titleize">#titleize</a>
110
- <li ><a href="#method-i-to_bool">#to_bool</a>
111
- <li ><a href="#method-i-to_bool-21">#to_bool!</a>
112
- <li ><a href="#method-i-to_date">#to_date</a>
113
- <li ><a href="#method-i-to_day">#to_day</a>
114
- <li ><a href="#method-i-to_pattern">#to_pattern</a>
115
- <li ><a href="#method-i-to_rx">#to_rx</a>
116
- <li ><a href="#method-i-wrap_style">#wrap_style</a>
117
- <li ><a href="#method-i-yaml-3F">#yaml?</a>
118
- </ul>
119
- </div>
120
-
121
- </div>
122
- </nav>
123
-
124
- <main role="main" aria-labelledby="class-String">
125
- <h1 id="class-String" class="class">
126
- class String
127
- </h1>
128
-
129
- <section class="description">
130
-
131
- <p><a href="String.html"><code>String</code></a> helpers</p>
132
-
133
- <p><a href="String.html"><code>String</code></a> helpers</p>
134
-
135
- </section>
136
-
137
- <section id="5Buntitled-5D" class="documentation-section">
138
-
139
-
140
-
141
-
142
-
143
- <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
144
- <header>
145
- <h3>Public Instance Methods</h3>
146
- </header>
147
-
148
- <div id="method-i-add_comment" class="method-detail ">
149
- <div class="method-header">
150
- <div class="method-heading">
151
- <span class="method-name">add_comment</span><span
152
- class="method-args">(key, value)</span>
153
- <span class="method-click-advice">click to toggle source</span>
154
- </div>
155
- </div>
156
-
157
- <div class="method-description">
158
-
159
-
160
- <div class="method-source-code" id="add_comment-source">
161
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 267</span>
162
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_comment</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>)
163
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">has_comment?</span>(<span class="ruby-identifier">key</span>)
164
- <span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/ *#{key}: .*?$/</span>, <span class="ruby-node">&quot;#{key}: #{value}&quot;</span>)
165
- <span class="ruby-keyword">else</span>
166
- <span class="ruby-identifier">lines</span> = <span class="ruby-identifier">split</span>(<span class="ruby-regexp">/\n/</span>)
167
- <span class="ruby-identifier">lines</span>.<span class="ruby-identifier">insert</span>(<span class="ruby-identifier">meta_insert_point</span>, <span class="ruby-node">&quot;&lt;!--\n#{key}: #{value}\n--&gt;&quot;</span>)
168
- <span class="ruby-identifier">lines</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot;\n&quot;</span>)
169
- <span class="ruby-keyword">end</span>
170
- <span class="ruby-keyword">end</span></pre>
171
- </div>
172
- </div>
173
-
174
-
175
- </div>
176
-
177
- <div id="method-i-add_mmd" class="method-detail ">
178
- <div class="method-header">
179
- <div class="method-heading">
180
- <span class="method-name">add_mmd</span><span
181
- class="method-args">(key, value)</span>
182
- <span class="method-click-advice">click to toggle source</span>
183
- </div>
184
- </div>
185
-
186
- <div class="method-description">
187
-
188
-
189
- <div class="method-source-code" id="add_mmd-source">
190
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 249</span>
191
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_mmd</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>)
192
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">match</span>(<span class="ruby-regexp">/(\A|\n) *#{key}: *\S+/i</span>)
193
- <span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/^ *#{key}:.*?\n/i</span>, <span class="ruby-node">&quot;#{key}: #{value}\n&quot;</span>)
194
- <span class="ruby-keyword">else</span>
195
- <span class="ruby-identifier">lines</span> = <span class="ruby-identifier">split</span>(<span class="ruby-regexp">/\n/</span>)
196
- <span class="ruby-identifier">lines</span>.<span class="ruby-identifier">insert</span>(<span class="ruby-identifier">meta_insert_point</span>, <span class="ruby-node">&quot;#{key}: #{value}&quot;</span>)
197
- <span class="ruby-identifier">lines</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot;\n&quot;</span>)
198
- <span class="ruby-keyword">end</span>
199
- <span class="ruby-keyword">end</span></pre>
200
- </div>
201
- </div>
202
-
203
-
204
- </div>
205
-
206
- <div id="method-i-add_yaml" class="method-detail ">
207
- <div class="method-header">
208
- <div class="method-heading">
209
- <span class="method-name">add_yaml</span><span
210
- class="method-args">(key, value)</span>
211
- <span class="method-click-advice">click to toggle source</span>
212
- </div>
213
- </div>
214
-
215
- <div class="method-description">
216
-
217
-
218
- <div class="method-source-code" id="add_yaml-source">
219
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 231</span>
220
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_yaml</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>)
221
- <span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/^---.*?\n(---|\.\.\.)/m</span>) <span class="ruby-keyword">do</span>
222
- <span class="ruby-identifier">m</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">last_match</span>
223
- <span class="ruby-identifier">yaml</span> = <span class="ruby-constant">YAML</span>.<span class="ruby-identifier">load</span>(<span class="ruby-identifier">m</span>[<span class="ruby-value">0</span>])
224
- <span class="ruby-identifier">yaml</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">value</span>
225
- <span class="ruby-node">&quot;#{YAML.dump(yaml)}\n---\n&quot;</span>
226
- <span class="ruby-keyword">end</span>
227
- <span class="ruby-keyword">end</span></pre>
228
- </div>
229
- </div>
230
-
231
-
232
- </div>
233
-
234
- <div id="method-i-append" class="method-detail ">
235
- <div class="method-header">
236
- <div class="method-heading">
237
- <span class="method-name">append</span><span
238
- class="method-args">(string)</span>
239
- <span class="method-click-advice">click to toggle source</span>
240
- </div>
241
- </div>
242
-
243
- <div class="method-description">
244
-
245
-
246
- <div class="method-source-code" id="append-source">
247
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 153</span>
248
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">append</span>(<span class="ruby-identifier">string</span>)
249
- <span class="ruby-node">&quot;#{self}\n#{string}&quot;</span>
250
- <span class="ruby-keyword">end</span></pre>
251
- </div>
252
- </div>
253
-
254
-
255
- </div>
256
-
257
- <div id="method-i-autolink" class="method-detail ">
258
- <div class="method-header">
259
- <div class="method-heading">
260
- <span class="method-name">autolink</span><span
261
- class="method-args">()</span>
262
- <span class="method-click-advice">click to toggle source</span>
263
- </div>
264
- </div>
265
-
266
- <div class="method-description">
267
-
268
-
269
- <div class="method-source-code" id="autolink-source">
270
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 304</span>
271
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">autolink</span>
272
- <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">%r{(?mi)(?&lt;!\(|]: )\b((?:[\w-]+?://)[-a-zA-Z0-9@:%._+~#=]{2,256}\b(?:[-a-zA-Z0-9@:%_+.~#?&amp;/=]*))}</span>,
273
- <span class="ruby-string">&#39;&lt;\1&gt;&#39;</span>)
274
- <span class="ruby-keyword">end</span></pre>
275
- </div>
276
- </div>
277
-
278
-
279
- </div>
280
-
281
- <div id="method-i-bool-3F" class="method-detail ">
282
- <div class="method-header">
283
- <div class="method-heading">
284
- <span class="method-name">bool?</span><span
285
- class="method-args">()</span>
286
- <span class="method-click-advice">click to toggle source</span>
287
- </div>
288
- </div>
289
-
290
- <div class="method-description">
291
- <p>Test if a string is a boolean</p>
292
-
293
- <p>@return [Boolean] test result</p>
294
-
295
- <div class="method-source-code" id="bool-3F-source">
296
- <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 108</span>
297
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">bool?</span>
298
- <span class="ruby-identifier">dup</span>.<span class="ruby-identifier">force_encoding</span>(<span class="ruby-string">&quot;utf-8&quot;</span>).<span class="ruby-identifier">match?</span>(<span class="ruby-regexp">/^(?:y(?:es)?|no?|t(?:rue)?|f(?:alse)?)$/</span>)
299
- <span class="ruby-keyword">end</span></pre>
300
- </div>
301
- </div>
302
-
303
-
304
- </div>
305
-
306
- <div id="method-i-bool_to_symbol" class="method-detail ">
307
- <div class="method-header">
308
- <div class="method-heading">
309
- <span class="method-name">bool_to_symbol</span><span
310
- class="method-args">()</span>
311
- <span class="method-click-advice">click to toggle source</span>
312
- </div>
313
- </div>
314
-
315
- <div class="method-description">
316
- <p>Convert a string boolean to symbol</p>
317
-
318
- <p>@return [Symbol] symbolized version</p>
319
-
320
- <div class="method-source-code" id="bool_to_symbol-source">
321
- <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 41</span>
322
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">bool_to_symbol</span>
323
- <span class="ruby-keyword">case</span> <span class="ruby-keyword">self</span>
324
- <span class="ruby-keyword">when</span> <span class="ruby-regexp">/(NOT|!!)/</span>
325
- <span class="ruby-value">:not</span>
326
- <span class="ruby-keyword">when</span> <span class="ruby-regexp">/(AND|&amp;&amp;)/</span>
327
- <span class="ruby-value">:and</span>
328
- <span class="ruby-keyword">else</span>
329
- <span class="ruby-value">:or</span>
330
- <span class="ruby-keyword">end</span>
331
- <span class="ruby-keyword">end</span></pre>
332
- </div>
333
- </div>
334
-
335
-
336
- </div>
337
-
338
- <div id="method-i-date-3F" class="method-detail ">
339
- <div class="method-header">
340
- <div class="method-heading">
341
- <span class="method-name">date?</span><span
342
- class="method-args">()</span>
343
- <span class="method-click-advice">click to toggle source</span>
344
- </div>
345
- </div>
346
-
347
- <div class="method-description">
348
- <p>Test a string to see if it’s a UTC date</p>
349
-
350
- <p>@return [Boolean] test result</p>
351
-
352
- <div class="method-source-code" id="date-3F-source">
353
- <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 57</span>
354
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">date?</span>
355
- <span class="ruby-identifier">dup</span>.<span class="ruby-identifier">force_encoding</span>(<span class="ruby-string">&quot;utf-8&quot;</span>).<span class="ruby-identifier">match?</span>(<span class="ruby-regexp">/^\d{4}-\d{2}-\d{2}( \d\d:\d\d)?$/</span>)
356
- <span class="ruby-keyword">end</span></pre>
357
- </div>
358
- </div>
359
-
360
-
361
- </div>
362
-
363
- <div id="method-i-delete_meta" class="method-detail ">
364
- <div class="method-header">
365
- <div class="method-heading">
366
- <span class="method-name">delete_meta</span><span
367
- class="method-args">(key)</span>
368
- <span class="method-click-advice">click to toggle source</span>
369
- </div>
370
- </div>
371
-
372
- <div class="method-description">
373
-
374
-
375
- <div class="method-source-code" id="delete_meta-source">
376
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 277</span>
377
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">delete_meta</span>(<span class="ruby-identifier">key</span>)
378
- <span class="ruby-keyword">case</span> <span class="ruby-identifier">meta_type</span>
379
- <span class="ruby-keyword">when</span> <span class="ruby-value">:yaml</span>
380
- <span class="ruby-identifier">delete_yaml</span>(<span class="ruby-identifier">key</span>)
381
- <span class="ruby-keyword">when</span> <span class="ruby-value">:mmd</span>
382
- <span class="ruby-identifier">delete_mmd</span>(<span class="ruby-identifier">key</span>)
383
- <span class="ruby-keyword">end</span>
384
- <span class="ruby-keyword">end</span></pre>
385
- </div>
386
- </div>
387
-
388
-
389
- </div>
390
-
391
- <div id="method-i-delete_mmd" class="method-detail ">
392
- <div class="method-header">
393
- <div class="method-heading">
394
- <span class="method-name">delete_mmd</span><span
395
- class="method-args">(key)</span>
396
- <span class="method-click-advice">click to toggle source</span>
397
- </div>
398
- </div>
399
-
400
- <div class="method-description">
401
-
402
-
403
- <div class="method-source-code" id="delete_mmd-source">
404
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 259</span>
405
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">delete_mmd</span>(<span class="ruby-identifier">key</span>)
406
- <span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/^ *#{key}:.*?\n/i</span>, <span class="ruby-string">&quot;&quot;</span>)
407
- <span class="ruby-keyword">end</span></pre>
408
- </div>
409
- </div>
410
-
411
-
412
- </div>
413
-
414
- <div id="method-i-delete_yaml" class="method-detail ">
415
- <div class="method-header">
416
- <div class="method-heading">
417
- <span class="method-name">delete_yaml</span><span
418
- class="method-args">(key)</span>
419
- <span class="method-click-advice">click to toggle source</span>
420
- </div>
421
- </div>
422
-
423
- <div class="method-description">
424
-
425
-
426
- <div class="method-source-code" id="delete_yaml-source">
427
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 240</span>
428
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">delete_yaml</span>(<span class="ruby-identifier">key</span>)
429
- <span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/^---.*?\n(---|\.\.\.)/m</span>) <span class="ruby-keyword">do</span>
430
- <span class="ruby-identifier">m</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">last_match</span>
431
- <span class="ruby-identifier">yaml</span> = <span class="ruby-constant">YAML</span>.<span class="ruby-identifier">load</span>(<span class="ruby-identifier">m</span>[<span class="ruby-value">0</span>])
432
- <span class="ruby-identifier">yaml</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">key</span>)
433
- <span class="ruby-node">&quot;#{YAML.dump(yaml)}\n---\n&quot;</span>
434
- <span class="ruby-keyword">end</span>
435
- <span class="ruby-keyword">end</span></pre>
436
- </div>
437
- </div>
438
-
439
-
440
- </div>
441
-
442
- <div id="method-i-first_h1" class="method-detail ">
443
- <div class="method-header">
444
- <div class="method-heading">
445
- <span class="method-name">first_h1</span><span
446
- class="method-args">()</span>
447
- <span class="method-click-advice">click to toggle source</span>
448
- </div>
449
- </div>
450
-
451
- <div class="method-description">
452
-
453
-
454
- <div class="method-source-code" id="first_h1-source">
455
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 50</span>
456
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">first_h1</span>
457
- <span class="ruby-identifier">first</span> = <span class="ruby-value">0</span>
458
- <span class="ruby-identifier">split</span>(<span class="ruby-regexp">/\n/</span>).<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">line</span>, <span class="ruby-identifier">idx</span><span class="ruby-operator">|</span>
459
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">line</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/^(# *\S|={2,} *$)/</span>
460
- <span class="ruby-identifier">first</span> = <span class="ruby-identifier">idx</span>
461
- <span class="ruby-keyword">break</span>
462
- <span class="ruby-keyword">end</span>
463
- <span class="ruby-keyword">end</span>
464
- <span class="ruby-identifier">first</span>
465
- <span class="ruby-keyword">end</span></pre>
466
- </div>
467
- </div>
468
-
469
-
470
- </div>
471
-
472
- <div id="method-i-first_h2" class="method-detail ">
473
- <div class="method-header">
474
- <div class="method-heading">
475
- <span class="method-name">first_h2</span><span
476
- class="method-args">()</span>
477
- <span class="method-click-advice">click to toggle source</span>
478
- </div>
479
- </div>
480
-
481
- <div class="method-description">
482
-
483
-
484
- <div class="method-source-code" id="first_h2-source">
485
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 61</span>
486
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">first_h2</span>
487
- <span class="ruby-identifier">first</span> = <span class="ruby-value">0</span>
488
- <span class="ruby-identifier">split</span>(<span class="ruby-regexp">/\n/</span>).<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">line</span>, <span class="ruby-identifier">idx</span><span class="ruby-operator">|</span>
489
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">line</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/^(## *\S|-{2,} *$)/</span>
490
- <span class="ruby-identifier">first</span> = <span class="ruby-identifier">idx</span>
491
- <span class="ruby-keyword">break</span>
492
- <span class="ruby-keyword">end</span>
493
- <span class="ruby-keyword">end</span>
494
- <span class="ruby-identifier">first</span>
495
- <span class="ruby-keyword">end</span></pre>
496
- </div>
497
- </div>
498
-
499
-
500
- </div>
501
-
502
- <div id="method-i-get_title" class="method-detail ">
503
- <div class="method-header">
504
- <div class="method-heading">
505
- <span class="method-name">get_title</span><span
506
- class="method-args">()</span>
507
- <span class="method-click-advice">click to toggle source</span>
508
- </div>
509
- </div>
510
-
511
- <div class="method-description">
512
-
513
-
514
- <div class="method-source-code" id="get_title-source">
515
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 186</span>
516
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_title</span>
517
- <span class="ruby-identifier">title</span> = <span class="ruby-keyword">nil</span>
518
-
519
- <span class="ruby-keyword">case</span> <span class="ruby-identifier">meta_type</span>
520
- <span class="ruby-keyword">when</span> <span class="ruby-value">:yaml</span>
521
- <span class="ruby-identifier">m</span> = <span class="ruby-identifier">match</span>(<span class="ruby-regexp">/^---.*?\n(---|\.\.\.)/m</span>)
522
- <span class="ruby-identifier">yaml</span> = <span class="ruby-constant">YAML</span>.<span class="ruby-identifier">load</span>(<span class="ruby-identifier">m</span>[<span class="ruby-value">0</span>])
523
- <span class="ruby-identifier">title</span> = <span class="ruby-identifier">yaml</span>[<span class="ruby-string">&quot;title&quot;</span>]
524
- <span class="ruby-keyword">when</span> <span class="ruby-value">:mmd</span>
525
- <span class="ruby-identifier">split</span>(<span class="ruby-regexp">/\n/</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
526
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">line</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/^ *title: *(\S.*?)$/i</span>
527
- <span class="ruby-identifier">title</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">last_match</span>(<span class="ruby-value">1</span>)
528
- <span class="ruby-keyword">break</span>
529
- <span class="ruby-keyword">end</span>
530
- <span class="ruby-keyword">end</span>
531
- <span class="ruby-keyword">else</span>
532
- <span class="ruby-identifier">m</span> = <span class="ruby-identifier">match</span>(<span class="ruby-regexp">/title: (.*?)$/i</span>)
533
- <span class="ruby-identifier">title</span> = <span class="ruby-identifier">m</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">m</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">:</span> <span class="ruby-keyword">nil</span>
534
- <span class="ruby-keyword">end</span>
535
-
536
- <span class="ruby-identifier">title</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">title_from_slug</span>.<span class="ruby-identifier">titleize</span>
537
-
538
- <span class="ruby-identifier">title</span>
539
- <span class="ruby-keyword">end</span></pre>
540
- </div>
541
- </div>
542
-
543
-
544
- </div>
545
-
546
- <div id="method-i-has_comment-3F" class="method-detail ">
547
- <div class="method-header">
548
- <div class="method-heading">
549
- <span class="method-name">has_comment?</span><span
550
- class="method-args">(key)</span>
551
- <span class="method-click-advice">click to toggle source</span>
552
- </div>
553
- </div>
554
-
555
- <div class="method-description">
556
-
557
-
558
- <div class="method-source-code" id="has_comment-3F-source">
559
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 263</span>
560
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">has_comment?</span>(<span class="ruby-identifier">key</span>)
561
- <span class="ruby-identifier">match</span>(<span class="ruby-regexp">/^&lt;!--.*?#{key}: \S.*?--&gt;/m</span>)
562
- <span class="ruby-keyword">end</span></pre>
563
- </div>
564
- </div>
565
-
566
-
567
- </div>
568
-
569
- <div id="method-i-insert_css" class="method-detail ">
570
- <div class="method-header">
571
- <div class="method-heading">
572
- <span class="method-name">insert_css</span><span
573
- class="method-args">(path)</span>
574
- <span class="method-click-advice">click to toggle source</span>
575
- </div>
576
- </div>
577
-
578
- <div class="method-description">
579
-
580
-
581
- <div class="method-source-code" id="insert_css-source">
582
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 95</span>
583
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">insert_css</span>(<span class="ruby-identifier">path</span>)
584
- <span class="ruby-identifier">path</span>.<span class="ruby-identifier">sub!</span>(<span class="ruby-regexp">/(\.css)?$/</span>, <span class="ruby-string">&#39;.css&#39;</span>)
585
-
586
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">path</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">%r{^[~/]}</span>
587
- <span class="ruby-identifier">path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">path</span>)
588
- <span class="ruby-keyword">elsif</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-string">&quot;~/.config/conductor/css&quot;</span>))
589
- <span class="ruby-identifier">new_path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-node">&quot;~/.config/conductor/css/#{path}&quot;</span>)
590
- <span class="ruby-identifier">path</span> = <span class="ruby-identifier">new_path</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">new_path</span>)
591
- <span class="ruby-keyword">elsif</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-string">&quot;~/.config/conductor/files&quot;</span>))
592
- <span class="ruby-identifier">new_path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-node">&quot;~/.config/conductor/files/#{path}&quot;</span>)
593
- <span class="ruby-identifier">path</span> = <span class="ruby-identifier">new_path</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">new_path</span>)
594
- <span class="ruby-keyword">end</span>
595
-
596
- <span class="ruby-keyword">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">path</span>)
597
- <span class="ruby-identifier">content</span> = <span class="ruby-constant">IO</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">path</span>)
598
- <span class="ruby-identifier">yui</span> = <span class="ruby-constant">YuiCompressor</span><span class="ruby-operator">::</span><span class="ruby-constant">Yui</span>.<span class="ruby-identifier">new</span>
599
- <span class="ruby-identifier">content</span> = <span class="ruby-identifier">yui</span>.<span class="ruby-identifier">compress</span>(<span class="ruby-identifier">content</span>)
600
- <span class="ruby-identifier">lines</span> = <span class="ruby-identifier">split</span>(<span class="ruby-regexp">/\n/</span>)
601
- <span class="ruby-identifier">insert_point</span> = <span class="ruby-identifier">meta_insert_point</span>
602
- <span class="ruby-identifier">insert_at</span> = <span class="ruby-identifier">insert_point</span>.<span class="ruby-identifier">positive?</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">insert_point</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-value">0</span>
603
- <span class="ruby-identifier">lines</span>.<span class="ruby-identifier">insert</span>(<span class="ruby-identifier">insert_at</span>, <span class="ruby-node">&quot;#{content.wrap_style}\n\n&quot;</span>)
604
- <span class="ruby-identifier">lines</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot;\n&quot;</span>)
605
- <span class="ruby-keyword">else</span>
606
- <span class="ruby-identifier">warn</span> <span class="ruby-node">&quot;File not found (#{path})&quot;</span>
607
- <span class="ruby-keyword">self</span>
608
- <span class="ruby-keyword">end</span>
609
- <span class="ruby-keyword">end</span></pre>
610
- </div>
611
- </div>
612
-
613
-
614
- </div>
615
-
616
- <div id="method-i-insert_file" class="method-detail ">
617
- <div class="method-header">
618
- <div class="method-heading">
619
- <span class="method-name">insert_file</span><span
620
- class="method-args">(path, type = :file, position = :end)</span>
621
- <span class="method-click-advice">click to toggle source</span>
622
- </div>
623
- </div>
624
-
625
- <div class="method-description">
626
-
627
-
628
- <div class="method-source-code" id="insert_file-source">
629
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 123</span>
630
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">insert_file</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">type</span> = <span class="ruby-value">:file</span>, <span class="ruby-identifier">position</span> = <span class="ruby-value">:end</span>)
631
- <span class="ruby-identifier">path</span>.<span class="ruby-identifier">strip!</span>
632
-
633
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">path</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">%r{^[~/]}</span>
634
- <span class="ruby-identifier">path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">path</span>)
635
- <span class="ruby-keyword">elsif</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-string">&quot;~/.config/conductor/files&quot;</span>))
636
- <span class="ruby-identifier">new_path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-node">&quot;~/.config/conductor/files/#{path}&quot;</span>)
637
- <span class="ruby-identifier">path</span> = <span class="ruby-identifier">new_path</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">new_path</span>)
638
- <span class="ruby-keyword">end</span>
639
-
640
- <span class="ruby-identifier">out</span> = <span class="ruby-keyword">case</span> <span class="ruby-identifier">type</span>
641
- <span class="ruby-keyword">when</span> <span class="ruby-value">:code</span>
642
- <span class="ruby-node">&quot;&lt;&lt;(#{path})&quot;</span>
643
- <span class="ruby-keyword">when</span> <span class="ruby-value">:raw</span>
644
- <span class="ruby-node">&quot;&lt;&lt;{#{path}}&quot;</span>
645
- <span class="ruby-keyword">else</span>
646
- <span class="ruby-node">&quot;&lt;&lt;[#{path}]&quot;</span>
647
- <span class="ruby-keyword">end</span>
648
- <span class="ruby-identifier">out</span> = <span class="ruby-node">&quot;\n#{out}\n&quot;</span>
649
-
650
- <span class="ruby-keyword">case</span> <span class="ruby-identifier">position</span>
651
- <span class="ruby-keyword">when</span> <span class="ruby-value">:start</span>
652
- <span class="ruby-node">&quot;#{out}\n#{self}&quot;</span>
653
- <span class="ruby-keyword">when</span> <span class="ruby-value">:h1</span>
654
- <span class="ruby-identifier">split</span>(<span class="ruby-regexp">/\n/</span>).<span class="ruby-identifier">insert</span>(<span class="ruby-identifier">first_h1</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>, <span class="ruby-identifier">out</span>).<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot;\n&quot;</span>)
655
- <span class="ruby-keyword">else</span>
656
- <span class="ruby-node">&quot;#{self}\n#{out}&quot;</span>
657
- <span class="ruby-keyword">end</span>
658
- <span class="ruby-keyword">end</span></pre>
659
- </div>
660
- </div>
661
-
662
-
663
- </div>
664
-
665
- <div id="method-i-insert_script" class="method-detail ">
666
- <div class="method-header">
667
- <div class="method-heading">
668
- <span class="method-name">insert_script</span><span
669
- class="method-args">(path)</span>
670
- <span class="method-click-advice">click to toggle source</span>
671
- </div>
672
- </div>
673
-
674
- <div class="method-description">
675
-
676
-
677
- <div class="method-source-code" id="insert_script-source">
678
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 157</span>
679
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">insert_script</span>(<span class="ruby-identifier">path</span>)
680
- <span class="ruby-identifier">path</span>.<span class="ruby-identifier">strip!</span>
681
- <span class="ruby-identifier">path</span> = <span class="ruby-node">&quot;#{path}.js&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">path</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/\.js$/</span>
682
-
683
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">path</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">%r{^[~/]}</span>
684
- <span class="ruby-identifier">path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">path</span>)
685
- <span class="ruby-keyword">else</span>
686
- <span class="ruby-identifier">new_path</span> = <span class="ruby-keyword">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-string">&quot;~/.config/conductor/javascript&quot;</span>))
687
- <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-node">&quot;~/.config/conductor/javascript/#{path}&quot;</span>)
688
- <span class="ruby-keyword">elsif</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-string">&quot;~/.config/conductor/javascripts&quot;</span>))
689
- <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-node">&quot;~/.config/conductor/javascripts/#{path}&quot;</span>)
690
- <span class="ruby-keyword">else</span>
691
- <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-node">&quot;~/.config/conductor/scripts/#{path}&quot;</span>)
692
- <span class="ruby-keyword">end</span>
693
-
694
- <span class="ruby-identifier">path</span> = <span class="ruby-identifier">new_path</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">new_path</span>)
695
- <span class="ruby-keyword">end</span>
696
-
697
- <span class="ruby-node">%(#{self}\n&lt;script type=&quot;javascript&quot; src=&quot;#{path}&quot;&gt;&lt;/script&gt;\n)</span>
698
- <span class="ruby-keyword">end</span></pre>
699
- </div>
700
- </div>
701
-
702
-
703
- </div>
704
-
705
- <div id="method-i-insert_title" class="method-detail ">
706
- <div class="method-header">
707
- <div class="method-heading">
708
- <span class="method-name">insert_title</span><span
709
- class="method-args">()</span>
710
- <span class="method-click-advice">click to toggle source</span>
711
- </div>
712
- </div>
713
-
714
- <div class="method-description">
715
-
716
-
717
- <div class="method-source-code" id="insert_title-source">
718
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 211</span>
719
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">insert_title</span>
720
- <span class="ruby-identifier">title</span> = <span class="ruby-identifier">get_title</span>
721
- <span class="ruby-identifier">lines</span> = <span class="ruby-identifier">split</span>(<span class="ruby-regexp">/\n/</span>)
722
- <span class="ruby-identifier">insert_point</span> = <span class="ruby-identifier">meta_insert_point</span>
723
- <span class="ruby-identifier">insert_at</span> = <span class="ruby-identifier">insert_point</span>.<span class="ruby-identifier">positive?</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">insert_point</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-value">0</span>
724
- <span class="ruby-identifier">lines</span>.<span class="ruby-identifier">insert</span>(<span class="ruby-identifier">insert_at</span>, <span class="ruby-node">&quot;# #{title}\n&quot;</span>)
725
- <span class="ruby-identifier">lines</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot;\n&quot;</span>)
726
- <span class="ruby-keyword">end</span></pre>
727
- </div>
728
- </div>
729
-
730
-
731
- </div>
732
-
733
- <div id="method-i-insert_toc" class="method-detail ">
734
- <div class="method-header">
735
- <div class="method-heading">
736
- <span class="method-name">insert_toc</span><span
737
- class="method-args">(max = nil, after = :h1)</span>
738
- <span class="method-click-advice">click to toggle source</span>
739
- </div>
740
- </div>
741
-
742
- <div class="method-description">
743
-
744
-
745
- <div class="method-source-code" id="insert_toc-source">
746
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 72</span>
747
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">insert_toc</span>(<span class="ruby-identifier">max</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">after</span> = <span class="ruby-value">:h1</span>)
748
- <span class="ruby-identifier">lines</span> = <span class="ruby-identifier">split</span>(<span class="ruby-regexp">/\n/</span>)
749
- <span class="ruby-identifier">max</span> = <span class="ruby-identifier">max</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">max</span>.<span class="ruby-identifier">to_i</span>.<span class="ruby-identifier">positive?</span> <span class="ruby-operator">?</span> <span class="ruby-node">&quot; max#{max}&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-string">&quot;&quot;</span>
750
- <span class="ruby-identifier">line</span> = <span class="ruby-keyword">case</span> <span class="ruby-identifier">after</span>.<span class="ruby-identifier">to_sym</span>
751
- <span class="ruby-keyword">when</span> <span class="ruby-value">:h2</span>
752
- <span class="ruby-identifier">first_h2</span>.<span class="ruby-identifier">positive?</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">first_h2</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-value">0</span>
753
- <span class="ruby-keyword">when</span> <span class="ruby-value">:h1</span>
754
- <span class="ruby-identifier">first_h1</span>.<span class="ruby-identifier">positive?</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">first_h1</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-value">0</span>
755
- <span class="ruby-keyword">else</span>
756
- <span class="ruby-value">0</span>
757
- <span class="ruby-keyword">end</span>
758
-
759
- <span class="ruby-identifier">lines</span>.<span class="ruby-identifier">insert</span>(<span class="ruby-identifier">line</span>, <span class="ruby-node">&quot;\n&lt;!--toc#{max}--&gt;\n&quot;</span>).<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot;\n&quot;</span>)
760
- <span class="ruby-keyword">end</span></pre>
761
- </div>
762
- </div>
763
-
764
-
765
- </div>
766
-
767
- <div id="method-i-meta-3F" class="method-detail ">
768
- <div class="method-header">
769
- <div class="method-heading">
770
- <span class="method-name">meta?</span><span
771
- class="method-args">()</span>
772
- <span class="method-click-advice">click to toggle source</span>
773
- </div>
774
- </div>
775
-
776
- <div class="method-description">
777
- <p>Test if a string starts with MMD metadata</p>
778
-
779
- <p>@return [Boolean] test result</p>
780
-
781
- <div class="method-source-code" id="meta-3F-source">
782
- <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 126</span>
783
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">meta?</span>
784
- <span class="ruby-identifier">dup</span>.<span class="ruby-identifier">force_encoding</span>(<span class="ruby-string">&#39;utf-8&#39;</span>).<span class="ruby-identifier">match?</span>(<span class="ruby-regexp">/^\w+: +\S+/m</span>)
785
- <span class="ruby-keyword">end</span></pre>
786
- </div>
787
- </div>
788
-
789
-
790
- </div>
791
-
792
- <div id="method-i-meta_insert_point" class="method-detail ">
793
- <div class="method-header">
794
- <div class="method-heading">
795
- <span class="method-name">meta_insert_point</span><span
796
- class="method-args">()</span>
797
- <span class="method-click-advice">click to toggle source</span>
798
- </div>
799
- </div>
800
-
801
- <div class="method-description">
802
-
803
-
804
- <div class="method-source-code" id="meta_insert_point-source">
805
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 24</span>
806
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">meta_insert_point</span>
807
- <span class="ruby-identifier">insert_point</span> = <span class="ruby-value">0</span>
808
-
809
- <span class="ruby-keyword">case</span> <span class="ruby-identifier">meta_type</span>
810
- <span class="ruby-keyword">when</span> <span class="ruby-value">:yaml</span>
811
- <span class="ruby-identifier">lines</span> = <span class="ruby-identifier">split</span>(<span class="ruby-regexp">/\n/</span>)
812
- <span class="ruby-identifier">lines</span>.<span class="ruby-identifier">shift</span>
813
- <span class="ruby-identifier">lines</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">line</span>, <span class="ruby-identifier">idx</span><span class="ruby-operator">|</span>
814
- <span class="ruby-keyword">next</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">line</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/^(...|---) *$/</span>
815
-
816
- <span class="ruby-identifier">insert_point</span> = <span class="ruby-identifier">idx</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>
817
- <span class="ruby-keyword">break</span>
818
- <span class="ruby-keyword">end</span>
819
- <span class="ruby-keyword">when</span> <span class="ruby-value">:mmd</span>
820
- <span class="ruby-identifier">lines</span> = <span class="ruby-identifier">split</span>(<span class="ruby-regexp">/\n/</span>)
821
- <span class="ruby-identifier">lines</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">line</span>, <span class="ruby-identifier">idx</span><span class="ruby-operator">|</span>
822
- <span class="ruby-keyword">next</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">line</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/^ *[ \w]+: +\S+/</span>
823
-
824
- <span class="ruby-identifier">insert_point</span> = <span class="ruby-identifier">idx</span>
825
- <span class="ruby-keyword">break</span>
826
- <span class="ruby-keyword">end</span>
827
- <span class="ruby-keyword">end</span>
828
-
829
- <span class="ruby-identifier">insert_point</span>
830
- <span class="ruby-keyword">end</span></pre>
831
- </div>
832
- </div>
833
-
834
-
835
- </div>
836
-
837
- <div id="method-i-meta_type" class="method-detail ">
838
- <div class="method-header">
839
- <div class="method-heading">
840
- <span class="method-name">meta_type</span><span
841
- class="method-args">()</span>
842
- <span class="method-click-advice">click to toggle source</span>
843
- </div>
844
- </div>
845
-
846
- <div class="method-description">
847
-
848
-
849
- <div class="method-source-code" id="meta_type-source">
850
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 12</span>
851
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">meta_type</span>
852
- <span class="ruby-identifier">lines</span> = <span class="ruby-identifier">split</span>(<span class="ruby-regexp">/\n/</span>)
853
- <span class="ruby-keyword">case</span> <span class="ruby-identifier">lines</span>[<span class="ruby-value">0</span>]
854
- <span class="ruby-keyword">when</span> <span class="ruby-regexp">/^--- *$/</span>
855
- <span class="ruby-value">:yaml</span>
856
- <span class="ruby-keyword">when</span> <span class="ruby-regexp">/^ *[ \w]+: +\S+/</span>
857
- <span class="ruby-value">:mmd</span>
858
- <span class="ruby-keyword">else</span>
859
- <span class="ruby-value">:none</span>
860
- <span class="ruby-keyword">end</span>
861
- <span class="ruby-keyword">end</span></pre>
862
- </div>
863
- </div>
864
-
865
-
866
- </div>
867
-
868
- <div id="method-i-normalize_filter" class="method-detail ">
869
- <div class="method-header">
870
- <div class="method-heading">
871
- <span class="method-name">normalize_filter</span><span
872
- class="method-args">()</span>
873
- <span class="method-click-advice">click to toggle source</span>
874
- </div>
875
- </div>
876
-
877
- <div class="method-description">
878
-
879
-
880
- <div class="method-source-code" id="normalize_filter-source">
881
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 5</span>
882
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">normalize_filter</span>
883
- <span class="ruby-identifier">parts</span> = <span class="ruby-identifier">match</span>(<span class="ruby-regexp">/(?&lt;filter&gt;[\w_]+)(?:\((?&lt;paren&gt;.*?)\))?$/i</span>)
884
- <span class="ruby-identifier">filter</span> = <span class="ruby-identifier">parts</span>[<span class="ruby-string">&quot;filter&quot;</span>].<span class="ruby-identifier">downcase</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">/_/</span>, <span class="ruby-string">&quot;&quot;</span>)
885
- <span class="ruby-identifier">params</span> = <span class="ruby-identifier">parts</span>[<span class="ruby-string">&quot;paren&quot;</span>]&amp;.<span class="ruby-identifier">split</span>(<span class="ruby-regexp">/ *, */</span>)
886
- [<span class="ruby-identifier">filter</span>, <span class="ruby-identifier">params</span>]
887
- <span class="ruby-keyword">end</span></pre>
888
- </div>
889
- </div>
890
-
891
-
892
- </div>
893
-
894
- <div id="method-i-normalize_include_type" class="method-detail ">
895
- <div class="method-header">
896
- <div class="method-heading">
897
- <span class="method-name">normalize_include_type</span><span
898
- class="method-args">()</span>
899
- <span class="method-click-advice">click to toggle source</span>
900
- </div>
901
- </div>
902
-
903
- <div class="method-description">
904
-
905
-
906
- <div class="method-source-code" id="normalize_include_type-source">
907
- <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 25</span>
908
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">normalize_include_type</span>
909
- <span class="ruby-keyword">case</span> <span class="ruby-keyword">self</span>
910
- <span class="ruby-keyword">when</span> <span class="ruby-regexp">/^c/</span>
911
- <span class="ruby-value">:code</span>
912
- <span class="ruby-keyword">when</span> <span class="ruby-regexp">/^r/</span>
913
- <span class="ruby-value">:raw</span>
914
- <span class="ruby-keyword">else</span>
915
- <span class="ruby-value">:file</span>
916
- <span class="ruby-keyword">end</span>
917
- <span class="ruby-keyword">end</span></pre>
918
- </div>
919
- </div>
920
-
921
-
922
- </div>
923
-
924
- <div id="method-i-normalize_position" class="method-detail ">
925
- <div class="method-header">
926
- <div class="method-heading">
927
- <span class="method-name">normalize_position</span><span
928
- class="method-args">()</span>
929
- <span class="method-click-advice">click to toggle source</span>
930
- </div>
931
- </div>
932
-
933
- <div class="method-description">
934
-
935
-
936
- <div class="method-source-code" id="normalize_position-source">
937
- <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 14</span>
938
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">normalize_position</span>
939
- <span class="ruby-keyword">case</span> <span class="ruby-keyword">self</span>
940
- <span class="ruby-keyword">when</span> <span class="ruby-regexp">/^(be|s|t)/</span>
941
- <span class="ruby-value">:start</span>
942
- <span class="ruby-keyword">when</span> <span class="ruby-regexp">/h1/</span>
943
- <span class="ruby-value">:h1</span>
944
- <span class="ruby-keyword">else</span>
945
- <span class="ruby-value">:end</span>
946
- <span class="ruby-keyword">end</span>
947
- <span class="ruby-keyword">end</span></pre>
948
- </div>
949
- </div>
950
-
951
-
952
- </div>
953
-
954
- <div id="method-i-number-3F" class="method-detail ">
955
- <div class="method-header">
956
- <div class="method-heading">
957
- <span class="method-name">number?</span><span
958
- class="method-args">()</span>
959
- <span class="method-click-advice">click to toggle source</span>
960
- </div>
961
- </div>
962
-
963
- <div class="method-description">
964
- <p>Test if a string is a number</p>
965
-
966
- <p>@return [Boolean] test result</p>
967
-
968
- <div class="method-source-code" id="number-3F-source">
969
- <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 99</span>
970
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">number?</span>
971
- <span class="ruby-identifier">to_f</span>.<span class="ruby-identifier">positive?</span>
972
- <span class="ruby-keyword">end</span></pre>
973
- </div>
974
- </div>
975
-
976
-
977
- </div>
978
-
979
- <div id="method-i-replace" class="method-detail ">
980
- <div class="method-header">
981
- <div class="method-heading">
982
- <span class="method-name">replace</span><span
983
- class="method-args">(regex, pattern)</span>
984
- <span class="method-click-advice">click to toggle source</span>
985
- </div>
986
- </div>
987
-
988
- <div class="method-description">
989
-
990
-
991
- <div class="method-source-code" id="replace-source">
992
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 300</span>
993
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">replace</span>(<span class="ruby-identifier">regex</span>, <span class="ruby-identifier">pattern</span>)
994
- <span class="ruby-identifier">sub</span>(<span class="ruby-identifier">regex</span>.<span class="ruby-identifier">to_rx</span>, <span class="ruby-identifier">pattern</span>.<span class="ruby-identifier">to_pattern</span>)
995
- <span class="ruby-keyword">end</span></pre>
996
- </div>
997
- </div>
998
-
999
-
1000
- </div>
1001
-
1002
- <div id="method-i-replace_all" class="method-detail ">
1003
- <div class="method-header">
1004
- <div class="method-heading">
1005
- <span class="method-name">replace_all</span><span
1006
- class="method-args">(regex, pattern)</span>
1007
- <span class="method-click-advice">click to toggle source</span>
1008
- </div>
1009
- </div>
1010
-
1011
- <div class="method-description">
1012
-
1013
-
1014
- <div class="method-source-code" id="replace_all-source">
1015
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 296</span>
1016
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">replace_all</span>(<span class="ruby-identifier">regex</span>, <span class="ruby-identifier">pattern</span>)
1017
- <span class="ruby-identifier">gsub</span>(<span class="ruby-identifier">regex</span>.<span class="ruby-identifier">to_rx</span>, <span class="ruby-identifier">pattern</span>.<span class="ruby-identifier">to_pattern</span>)
1018
- <span class="ruby-keyword">end</span></pre>
1019
- </div>
1020
- </div>
1021
-
1022
-
1023
- </div>
1024
-
1025
- <div id="method-i-set_meta" class="method-detail ">
1026
- <div class="method-header">
1027
- <div class="method-heading">
1028
- <span class="method-name">set_meta</span><span
1029
- class="method-args">(key, value, style: :comment)</span>
1030
- <span class="method-click-advice">click to toggle source</span>
1031
- </div>
1032
- </div>
1033
-
1034
- <div class="method-description">
1035
-
1036
-
1037
- <div class="method-source-code" id="set_meta-source">
1038
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 220</span>
1039
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">set_meta</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>, <span class="ruby-value">style:</span> <span class="ruby-value">:comment</span>)
1040
- <span class="ruby-keyword">case</span> <span class="ruby-identifier">style</span>
1041
- <span class="ruby-keyword">when</span> <span class="ruby-value">:yaml</span>
1042
- <span class="ruby-identifier">add_yaml</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>)
1043
- <span class="ruby-keyword">when</span> <span class="ruby-value">:mmd</span>
1044
- <span class="ruby-identifier">add_mmd</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>)
1045
- <span class="ruby-keyword">else</span> <span class="ruby-comment"># comment or none</span>
1046
- <span class="ruby-identifier">add_comment</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>)
1047
- <span class="ruby-keyword">end</span>
1048
- <span class="ruby-keyword">end</span></pre>
1049
- </div>
1050
- </div>
1051
-
1052
-
1053
- </div>
1054
-
1055
- <div id="method-i-strip_meta" class="method-detail ">
1056
- <div class="method-header">
1057
- <div class="method-heading">
1058
- <span class="method-name">strip_meta</span><span
1059
- class="method-args">()</span>
1060
- <span class="method-click-advice">click to toggle source</span>
1061
- </div>
1062
- </div>
1063
-
1064
- <div class="method-description">
1065
-
1066
-
1067
- <div class="method-source-code" id="strip_meta-source">
1068
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 286</span>
1069
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">strip_meta</span>
1070
- <span class="ruby-keyword">case</span> <span class="ruby-identifier">meta_type</span>
1071
- <span class="ruby-keyword">when</span> <span class="ruby-value">:yaml</span>
1072
- <span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/^---.*?(---|...)/m</span>, <span class="ruby-string">&quot;&quot;</span>)
1073
- <span class="ruby-keyword">when</span> <span class="ruby-value">:mmd</span>
1074
- <span class="ruby-identifier">lines</span> = <span class="ruby-identifier">split</span>(<span class="ruby-regexp">/\n/</span>)
1075
- <span class="ruby-identifier">lines</span>[<span class="ruby-identifier">meta_insert_point</span><span class="ruby-operator">..</span>]
1076
- <span class="ruby-keyword">end</span>
1077
- <span class="ruby-keyword">end</span></pre>
1078
- </div>
1079
- </div>
1080
-
1081
-
1082
- </div>
1083
-
1084
- <div id="method-i-strip_time" class="method-detail ">
1085
- <div class="method-header">
1086
- <div class="method-heading">
1087
- <span class="method-name">strip_time</span><span
1088
- class="method-args">()</span>
1089
- <span class="method-click-advice">click to toggle source</span>
1090
- </div>
1091
- </div>
1092
-
1093
- <div class="method-description">
1094
- <p>Remove time from string</p>
1095
-
1096
- <p>@return [String] string with time removed</p>
1097
-
1098
- <div class="method-source-code" id="strip_time-source">
1099
- <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 85</span>
1100
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">strip_time</span>
1101
- <span class="ruby-identifier">dup</span>.<span class="ruby-identifier">force_encoding</span>(<span class="ruby-string">&quot;utf-8&quot;</span>).<span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/ \d{1,2}(:\d\d)? *([ap]m)?/i</span>, <span class="ruby-string">&quot;&quot;</span>)
1102
- <span class="ruby-keyword">end</span></pre>
1103
- </div>
1104
- </div>
1105
-
1106
-
1107
- </div>
1108
-
1109
- <div id="method-i-time-3F" class="method-detail ">
1110
- <div class="method-header">
1111
- <div class="method-heading">
1112
- <span class="method-name">time?</span><span
1113
- class="method-args">()</span>
1114
- <span class="method-click-advice">click to toggle source</span>
1115
- </div>
1116
- </div>
1117
-
1118
- <div class="method-description">
1119
- <p>Test a string to see if it includes a time</p>
1120
-
1121
- <p>@return [Boolean] test result</p>
1122
-
1123
- <div class="method-source-code" id="time-3F-source">
1124
- <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 66</span>
1125
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">time?</span>
1126
- <span class="ruby-identifier">dup</span>.<span class="ruby-identifier">force_encoding</span>(<span class="ruby-string">&quot;utf-8&quot;</span>).<span class="ruby-identifier">match</span>(<span class="ruby-regexp">/ \d{1,2}(:\d\d)? *([ap]m)?/i</span>)
1127
- <span class="ruby-keyword">end</span></pre>
1128
- </div>
1129
- </div>
1130
-
1131
-
1132
- </div>
1133
-
1134
- <div id="method-i-title_from_slug" class="method-detail ">
1135
- <div class="method-header">
1136
- <div class="method-heading">
1137
- <span class="method-name">title_from_slug</span><span
1138
- class="method-args">()</span>
1139
- <span class="method-click-advice">click to toggle source</span>
1140
- </div>
1141
- </div>
1142
-
1143
- <div class="method-description">
1144
-
1145
-
1146
- <div class="method-source-code" id="title_from_slug-source">
1147
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 178</span>
1148
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">title_from_slug</span>
1149
- <span class="ruby-identifier">filename</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-constant">Conductor</span><span class="ruby-operator">::</span><span class="ruby-constant">Env</span>.<span class="ruby-identifier">env</span>[<span class="ruby-value">:filepath</span>]).<span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/\.[a-z]+$/i</span>, <span class="ruby-string">&quot;&quot;</span>)
1150
- <span class="ruby-identifier">filename</span>.<span class="ruby-identifier">sub!</span>(<span class="ruby-regexp">/-?\d{4}-\d{2}-\d{2}-?/</span>, <span class="ruby-string">&quot;&quot;</span>)
1151
- <span class="ruby-identifier">filename</span>.<span class="ruby-identifier">sub!</span>(<span class="ruby-regexp">/\bdot\b/</span>, <span class="ruby-string">&quot;.&quot;</span>)
1152
- <span class="ruby-identifier">filename</span>.<span class="ruby-identifier">sub!</span>(<span class="ruby-regexp">/ dash /</span>, <span class="ruby-string">&quot;-&quot;</span>)
1153
- <span class="ruby-identifier">filename</span>
1154
- <span class="ruby-keyword">end</span></pre>
1155
- </div>
1156
- </div>
1157
-
1158
-
1159
- </div>
1160
-
1161
- <div id="method-i-titleize" class="method-detail ">
1162
- <div class="method-header">
1163
- <div class="method-heading">
1164
- <span class="method-name">titleize</span><span
1165
- class="method-args">()</span>
1166
- <span class="method-click-advice">click to toggle source</span>
1167
- </div>
1168
- </div>
1169
-
1170
- <div class="method-description">
1171
- <p>Titlecase a string</p>
1172
-
1173
- <p>@return Titleized string</p>
1174
-
1175
- <div class="method-source-code" id="titleize-source">
1176
- <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 10</span>
1177
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">titleize</span>
1178
- <span class="ruby-identifier">split</span>(<span class="ruby-regexp">/(\W)/</span>).<span class="ruby-identifier">map</span>(<span class="ruby-operator">&amp;</span><span class="ruby-value">:capitalize</span>).<span class="ruby-identifier">join</span>
1179
- <span class="ruby-keyword">end</span></pre>
1180
- </div>
1181
- </div>
1182
-
1183
-
1184
- </div>
1185
-
1186
- <div id="method-i-to_bool" class="method-detail ">
1187
- <div class="method-header">
1188
- <div class="method-heading">
1189
- <span class="method-name">to_bool</span><span
1190
- class="method-args">()</span>
1191
- <span class="method-click-advice">click to toggle source</span>
1192
- </div>
1193
- </div>
1194
-
1195
- <div class="method-description">
1196
- <p>Returns a bool representation of the string.</p>
1197
-
1198
- <p>@return [Boolean] Bool representation of the object.</p>
1199
-
1200
- <div class="method-source-code" id="to_bool-source">
1201
- <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 145</span>
1202
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_bool</span>
1203
- <span class="ruby-keyword">case</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">force_encoding</span>(<span class="ruby-string">&#39;utf-8&#39;</span>)
1204
- <span class="ruby-keyword">when</span> <span class="ruby-regexp">/^[yt]/i</span>
1205
- <span class="ruby-keyword">true</span>
1206
- <span class="ruby-keyword">else</span>
1207
- <span class="ruby-keyword">false</span>
1208
- <span class="ruby-keyword">end</span>
1209
- <span class="ruby-keyword">end</span></pre>
1210
- </div>
1211
- </div>
1212
-
1213
-
1214
- </div>
1215
-
1216
- <div id="method-i-to_bool-21" class="method-detail ">
1217
- <div class="method-header">
1218
- <div class="method-heading">
1219
- <span class="method-name">to_bool!</span><span
1220
- class="method-args">()</span>
1221
- <span class="method-click-advice">click to toggle source</span>
1222
- </div>
1223
- </div>
1224
-
1225
- <div class="method-description">
1226
- <p>Destructive version of <a href="String.html#method-i-to_bool"><code>to_bool</code></a></p>
1227
-
1228
- <p>@see <a href="String.html#method-i-to_bool"><code>to_bool</code></a></p>
1229
-
1230
- <div class="method-source-code" id="to_bool-21-source">
1231
- <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 136</span>
1232
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_bool!</span>
1233
- <span class="ruby-identifier">replace</span> <span class="ruby-identifier">to_bool</span>
1234
- <span class="ruby-keyword">end</span></pre>
1235
- </div>
1236
- </div>
1237
-
1238
-
1239
- </div>
1240
-
1241
- <div id="method-i-to_date" class="method-detail ">
1242
- <div class="method-header">
1243
- <div class="method-heading">
1244
- <span class="method-name">to_date</span><span
1245
- class="method-args">()</span>
1246
- <span class="method-click-advice">click to toggle source</span>
1247
- </div>
1248
- </div>
1249
-
1250
- <div class="method-description">
1251
- <p>Convert a natural language string to a Date</p>
1252
-
1253
- <pre class="ruby"><span class="ruby-identifier">object</span>
1254
- </pre>
1255
-
1256
- <p>@return [Date] Resulting Date object</p>
1257
-
1258
- <div class="method-source-code" id="to_date-source">
1259
- <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 76</span>
1260
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_date</span>
1261
- <span class="ruby-constant">Chronic</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">dup</span>.<span class="ruby-identifier">force_encoding</span>(<span class="ruby-string">&quot;utf-8&quot;</span>))
1262
- <span class="ruby-keyword">end</span></pre>
1263
- </div>
1264
- </div>
1265
-
1266
-
1267
- </div>
1268
-
1269
- <div id="method-i-to_day" class="method-detail ">
1270
- <div class="method-header">
1271
- <div class="method-heading">
1272
- <span class="method-name">to_day</span><span
1273
- class="method-args">(time = :end)</span>
1274
- <span class="method-click-advice">click to toggle source</span>
1275
- </div>
1276
- </div>
1277
-
1278
- <div class="method-description">
1279
-
1280
-
1281
- <div class="method-source-code" id="to_day-source">
1282
- <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 89</span>
1283
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_day</span>(<span class="ruby-identifier">time</span> = <span class="ruby-value">:end</span>)
1284
- <span class="ruby-identifier">t</span> = <span class="ruby-identifier">time</span> <span class="ruby-operator">==</span> <span class="ruby-value">:end</span> <span class="ruby-operator">?</span> <span class="ruby-string">&quot;23:59&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-string">&quot;00:00&quot;</span>
1285
- <span class="ruby-constant">Chronic</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-node">&quot;#{strip_time} #{t}&quot;</span>)
1286
- <span class="ruby-keyword">end</span></pre>
1287
- </div>
1288
- </div>
1289
-
1290
-
1291
- </div>
1292
-
1293
- <div id="method-i-to_pattern" class="method-detail ">
1294
- <div class="method-header">
1295
- <div class="method-heading">
1296
- <span class="method-name">to_pattern</span><span
1297
- class="method-args">()</span>
1298
- <span class="method-click-advice">click to toggle source</span>
1299
- </div>
1300
- </div>
1301
-
1302
- <div class="method-description">
1303
-
1304
-
1305
- <div class="method-source-code" id="to_pattern-source">
1306
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 320</span>
1307
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_pattern</span>
1308
- <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">/\$(\d+)/</span>, <span class="ruby-string">&#39;\\\\\1&#39;</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">/(^[&quot;&#39;]|[&quot;&#39;]$)/</span>, <span class="ruby-string">&quot;&quot;</span>)
1309
- <span class="ruby-keyword">end</span></pre>
1310
- </div>
1311
- </div>
1312
-
1313
-
1314
- </div>
1315
-
1316
- <div id="method-i-to_rx" class="method-detail ">
1317
- <div class="method-header">
1318
- <div class="method-heading">
1319
- <span class="method-name">to_rx</span><span
1320
- class="method-args">()</span>
1321
- <span class="method-click-advice">click to toggle source</span>
1322
- </div>
1323
- </div>
1324
-
1325
- <div class="method-description">
1326
-
1327
-
1328
- <div class="method-source-code" id="to_rx-source">
1329
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 309</span>
1330
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_rx</span>
1331
- <span class="ruby-keyword">if</span> <span class="ruby-keyword">self</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">%r{^/(.*?)/([im]+)?$}</span>
1332
- <span class="ruby-identifier">m</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">last_match</span>
1333
- <span class="ruby-identifier">regex</span> = <span class="ruby-identifier">m</span>[<span class="ruby-value">1</span>]
1334
- <span class="ruby-identifier">flags</span> = <span class="ruby-identifier">m</span>[<span class="ruby-value">2</span>]
1335
- <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">regex</span>, <span class="ruby-identifier">flags</span>)
1336
- <span class="ruby-keyword">else</span>
1337
- <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">escape</span>(<span class="ruby-keyword">self</span>))
1338
- <span class="ruby-keyword">end</span>
1339
- <span class="ruby-keyword">end</span></pre>
1340
- </div>
1341
- </div>
1342
-
1343
-
1344
- </div>
1345
-
1346
- <div id="method-i-wrap_style" class="method-detail ">
1347
- <div class="method-header">
1348
- <div class="method-heading">
1349
- <span class="method-name">wrap_style</span><span
1350
- class="method-args">()</span>
1351
- <span class="method-click-advice">click to toggle source</span>
1352
- </div>
1353
- </div>
1354
-
1355
- <div class="method-description">
1356
-
1357
-
1358
- <div class="method-source-code" id="wrap_style-source">
1359
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 87</span>
1360
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">wrap_style</span>
1361
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">match</span>(<span class="ruby-regexp">%r{&lt;style&gt;.*?&lt;/style&gt;}m</span>)
1362
- <span class="ruby-keyword">self</span>
1363
- <span class="ruby-keyword">else</span>
1364
- <span class="ruby-node">&quot;&lt;style&gt;#{self}&lt;/style&gt;&quot;</span>
1365
- <span class="ruby-keyword">end</span>
1366
- <span class="ruby-keyword">end</span></pre>
1367
- </div>
1368
- </div>
1369
-
1370
-
1371
- </div>
1372
-
1373
- <div id="method-i-yaml-3F" class="method-detail ">
1374
- <div class="method-header">
1375
- <div class="method-heading">
1376
- <span class="method-name">yaml?</span><span
1377
- class="method-args">()</span>
1378
- <span class="method-click-advice">click to toggle source</span>
1379
- </div>
1380
- </div>
1381
-
1382
- <div class="method-description">
1383
- <p>Test if string starts with YAML</p>
1384
-
1385
- <p>@return [Boolean] test result</p>
1386
-
1387
- <div class="method-source-code" id="yaml-3F-source">
1388
- <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 117</span>
1389
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">yaml?</span>
1390
- <span class="ruby-identifier">dup</span>.<span class="ruby-identifier">force_encoding</span>(<span class="ruby-string">&#39;utf-8&#39;</span>).<span class="ruby-identifier">match?</span>(<span class="ruby-regexp">/^---/m</span>)
1391
- <span class="ruby-keyword">end</span></pre>
1392
- </div>
1393
- </div>
1394
-
1395
-
1396
- </div>
1397
-
1398
- </section>
1399
-
1400
- </section>
1401
- </main>
1402
-
1403
-
1404
- <footer id="validator-badges" role="contentinfo">
1405
- <p><a href="https://validator.w3.org/check/referer">Validate</a>
1406
- <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.7.0.
1407
- <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
1408
- </footer>
1409
-