marked-conductor 1.0.9 → 1.0.11

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 (70) hide show
  1. checksums.yaml +4 -4
  2. data/.irbrc +2 -0
  3. data/CHANGELOG.md +23 -0
  4. data/README.rdoc +1 -1
  5. data/bin/conductor +98 -67
  6. data/html/Array.html +160 -0
  7. data/html/Conductor/Command.html +271 -0
  8. data/html/Conductor/Condition.html +791 -0
  9. data/html/Conductor/Config.html +170 -0
  10. data/html/Conductor/Env.html +220 -0
  11. data/html/Conductor/Script.html +288 -0
  12. data/html/Conductor.html +355 -0
  13. data/html/FalseClass.html +138 -0
  14. data/html/Hash.html +160 -0
  15. data/html/Object.html +138 -0
  16. data/html/README_rdoc.html +86 -0
  17. data/html/String.html +440 -0
  18. data/html/TrueClass.html +138 -0
  19. data/html/created.rid +14 -0
  20. data/html/css/fonts.css +167 -0
  21. data/html/css/rdoc.css +687 -0
  22. data/html/fonts/Lato-Light.ttf +0 -0
  23. data/html/fonts/Lato-LightItalic.ttf +0 -0
  24. data/html/fonts/Lato-Regular.ttf +0 -0
  25. data/html/fonts/Lato-RegularItalic.ttf +0 -0
  26. data/html/fonts/SourceCodePro-Bold.ttf +0 -0
  27. data/html/fonts/SourceCodePro-Regular.ttf +0 -0
  28. data/html/images/add.png +0 -0
  29. data/html/images/arrow_up.png +0 -0
  30. data/html/images/brick.png +0 -0
  31. data/html/images/brick_link.png +0 -0
  32. data/html/images/bug.png +0 -0
  33. data/html/images/bullet_black.png +0 -0
  34. data/html/images/bullet_toggle_minus.png +0 -0
  35. data/html/images/bullet_toggle_plus.png +0 -0
  36. data/html/images/date.png +0 -0
  37. data/html/images/delete.png +0 -0
  38. data/html/images/find.png +0 -0
  39. data/html/images/loadingAnimation.gif +0 -0
  40. data/html/images/macFFBgHack.png +0 -0
  41. data/html/images/package.png +0 -0
  42. data/html/images/page_green.png +0 -0
  43. data/html/images/page_white_text.png +0 -0
  44. data/html/images/page_white_width.png +0 -0
  45. data/html/images/plugin.png +0 -0
  46. data/html/images/ruby.png +0 -0
  47. data/html/images/tag_blue.png +0 -0
  48. data/html/images/tag_green.png +0 -0
  49. data/html/images/transparent.png +0 -0
  50. data/html/images/wrench.png +0 -0
  51. data/html/images/wrench_orange.png +0 -0
  52. data/html/images/zoom.png +0 -0
  53. data/html/index.html +105 -0
  54. data/html/js/darkfish.js +97 -0
  55. data/html/js/navigation.js +105 -0
  56. data/html/js/navigation.js.gz +0 -0
  57. data/html/js/search.js +110 -0
  58. data/html/js/search_index.js +1 -0
  59. data/html/js/search_index.js.gz +0 -0
  60. data/html/js/searcher.js +229 -0
  61. data/html/js/searcher.js.gz +0 -0
  62. data/html/table_of_contents.html +345 -0
  63. data/lib/conductor/condition.rb +25 -10
  64. data/lib/conductor/env.rb +18 -7
  65. data/lib/conductor/script.rb +40 -18
  66. data/lib/conductor/string.rb +58 -6
  67. data/lib/conductor/version.rb +1 -1
  68. data/lib/conductor.rb +1 -0
  69. data/marked-conductor.gemspec +3 -3
  70. metadata +89 -32
@@ -0,0 +1,229 @@
1
+ Searcher = function(data) {
2
+ this.data = data;
3
+ this.handlers = [];
4
+ }
5
+
6
+ Searcher.prototype = new function() {
7
+ // search is performed in chunks of 1000 for non-blocking user input
8
+ var CHUNK_SIZE = 1000;
9
+ // do not try to find more than 100 results
10
+ var MAX_RESULTS = 100;
11
+ var huid = 1;
12
+ var suid = 1;
13
+ var runs = 0;
14
+
15
+ this.find = function(query) {
16
+ var queries = splitQuery(query);
17
+ var regexps = buildRegexps(queries);
18
+ var highlighters = buildHilighters(queries);
19
+ var state = { from: 0, pass: 0, limit: MAX_RESULTS, n: suid++};
20
+ var _this = this;
21
+
22
+ this.currentSuid = state.n;
23
+
24
+ if (!query) return;
25
+
26
+ var run = function() {
27
+ // stop current search thread if new search started
28
+ if (state.n != _this.currentSuid) return;
29
+
30
+ var results =
31
+ performSearch(_this.data, regexps, queries, highlighters, state);
32
+ var hasMore = (state.limit > 0 && state.pass < 4);
33
+
34
+ triggerResults.call(_this, results, !hasMore);
35
+ if (hasMore) {
36
+ setTimeout(run, 2);
37
+ }
38
+ runs++;
39
+ };
40
+ runs = 0;
41
+
42
+ // start search thread
43
+ run();
44
+ }
45
+
46
+ /* ----- Events ------ */
47
+ this.ready = function(fn) {
48
+ fn.huid = huid;
49
+ this.handlers.push(fn);
50
+ }
51
+
52
+ /* ----- Utilities ------ */
53
+ function splitQuery(query) {
54
+ return query.split(/(\s+|::?|\(\)?)/).filter(function(string) {
55
+ return string.match(/\S/);
56
+ });
57
+ }
58
+
59
+ function buildRegexps(queries) {
60
+ return queries.map(function(query) {
61
+ return new RegExp(query.replace(/(.)/g, '([$1])([^$1]*?)'), 'i');
62
+ });
63
+ }
64
+
65
+ function buildHilighters(queries) {
66
+ return queries.map(function(query) {
67
+ return query.split('').map(function(l, i) {
68
+ return '\u0001$' + (i*2+1) + '\u0002$' + (i*2+2);
69
+ }).join('');
70
+ });
71
+ }
72
+
73
+ // function longMatchRegexp(index, longIndex, regexps) {
74
+ // for (var i = regexps.length - 1; i >= 0; i--){
75
+ // if (!index.match(regexps[i]) && !longIndex.match(regexps[i])) return false;
76
+ // };
77
+ // return true;
78
+ // }
79
+
80
+
81
+ /* ----- Mathchers ------ */
82
+
83
+ /*
84
+ * This record matches if the index starts with queries[0] and the record
85
+ * matches all of the regexps
86
+ */
87
+ function matchPassBeginning(index, longIndex, queries, regexps) {
88
+ if (index.indexOf(queries[0]) != 0) return false;
89
+ for (var i=1, l = regexps.length; i < l; i++) {
90
+ if (!index.match(regexps[i]) && !longIndex.match(regexps[i]))
91
+ return false;
92
+ };
93
+ return true;
94
+ }
95
+
96
+ /*
97
+ * This record matches if the longIndex starts with queries[0] and the
98
+ * longIndex matches all of the regexps
99
+ */
100
+ function matchPassLongIndex(index, longIndex, queries, regexps) {
101
+ if (longIndex.indexOf(queries[0]) != 0) return false;
102
+ for (var i=1, l = regexps.length; i < l; i++) {
103
+ if (!longIndex.match(regexps[i]))
104
+ return false;
105
+ };
106
+ return true;
107
+ }
108
+
109
+ /*
110
+ * This record matches if the index contains queries[0] and the record
111
+ * matches all of the regexps
112
+ */
113
+ function matchPassContains(index, longIndex, queries, regexps) {
114
+ if (index.indexOf(queries[0]) == -1) return false;
115
+ for (var i=1, l = regexps.length; i < l; i++) {
116
+ if (!index.match(regexps[i]) && !longIndex.match(regexps[i]))
117
+ return false;
118
+ };
119
+ return true;
120
+ }
121
+
122
+ /*
123
+ * This record matches if regexps[0] matches the index and the record
124
+ * matches all of the regexps
125
+ */
126
+ function matchPassRegexp(index, longIndex, queries, regexps) {
127
+ if (!index.match(regexps[0])) return false;
128
+ for (var i=1, l = regexps.length; i < l; i++) {
129
+ if (!index.match(regexps[i]) && !longIndex.match(regexps[i]))
130
+ return false;
131
+ };
132
+ return true;
133
+ }
134
+
135
+
136
+ /* ----- Highlighters ------ */
137
+ function highlightRegexp(info, queries, regexps, highlighters) {
138
+ var result = createResult(info);
139
+ for (var i=0, l = regexps.length; i < l; i++) {
140
+ result.title = result.title.replace(regexps[i], highlighters[i]);
141
+ result.namespace = result.namespace.replace(regexps[i], highlighters[i]);
142
+ };
143
+ return result;
144
+ }
145
+
146
+ function hltSubstring(string, pos, length) {
147
+ return string.substring(0, pos) + '\u0001' + string.substring(pos, pos + length) + '\u0002' + string.substring(pos + length);
148
+ }
149
+
150
+ function highlightQuery(info, queries, regexps, highlighters) {
151
+ var result = createResult(info);
152
+ var pos = 0;
153
+ var lcTitle = result.title.toLowerCase();
154
+
155
+ pos = lcTitle.indexOf(queries[0]);
156
+ if (pos != -1) {
157
+ result.title = hltSubstring(result.title, pos, queries[0].length);
158
+ }
159
+
160
+ result.namespace = result.namespace.replace(regexps[0], highlighters[0]);
161
+ for (var i=1, l = regexps.length; i < l; i++) {
162
+ result.title = result.title.replace(regexps[i], highlighters[i]);
163
+ result.namespace = result.namespace.replace(regexps[i], highlighters[i]);
164
+ };
165
+ return result;
166
+ }
167
+
168
+ function createResult(info) {
169
+ var result = {};
170
+ result.title = info[0];
171
+ result.namespace = info[1];
172
+ result.path = info[2];
173
+ result.params = info[3];
174
+ result.snippet = info[4];
175
+ result.badge = info[6];
176
+ return result;
177
+ }
178
+
179
+ /* ----- Searching ------ */
180
+ function performSearch(data, regexps, queries, highlighters, state) {
181
+ var searchIndex = data.searchIndex;
182
+ var longSearchIndex = data.longSearchIndex;
183
+ var info = data.info;
184
+ var result = [];
185
+ var i = state.from;
186
+ var l = searchIndex.length;
187
+ var togo = CHUNK_SIZE;
188
+ var matchFunc, hltFunc;
189
+
190
+ while (state.pass < 4 && state.limit > 0 && togo > 0) {
191
+ if (state.pass == 0) {
192
+ matchFunc = matchPassBeginning;
193
+ hltFunc = highlightQuery;
194
+ } else if (state.pass == 1) {
195
+ matchFunc = matchPassLongIndex;
196
+ hltFunc = highlightQuery;
197
+ } else if (state.pass == 2) {
198
+ matchFunc = matchPassContains;
199
+ hltFunc = highlightQuery;
200
+ } else if (state.pass == 3) {
201
+ matchFunc = matchPassRegexp;
202
+ hltFunc = highlightRegexp;
203
+ }
204
+
205
+ for (; togo > 0 && i < l && state.limit > 0; i++, togo--) {
206
+ if (info[i].n == state.n) continue;
207
+ if (matchFunc(searchIndex[i], longSearchIndex[i], queries, regexps)) {
208
+ info[i].n = state.n;
209
+ result.push(hltFunc(info[i], queries, regexps, highlighters));
210
+ state.limit--;
211
+ }
212
+ };
213
+ if (searchIndex.length <= i) {
214
+ state.pass++;
215
+ i = state.from = 0;
216
+ } else {
217
+ state.from = i;
218
+ }
219
+ }
220
+ return result;
221
+ }
222
+
223
+ function triggerResults(results, isLast) {
224
+ this.handlers.forEach(function(fn) {
225
+ fn.call(this, results, isLast)
226
+ });
227
+ }
228
+ }
229
+
Binary file
@@ -0,0 +1,345 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta charset="UTF-8">
6
+
7
+ <title>Table of Contents - 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" class="table-of-contents">
25
+ <main role="main">
26
+ <h1 class="class">Table of Contents - Marked Conductor</h1>
27
+
28
+ <h2 id="pages">Pages</h2>
29
+ <ul>
30
+ <li class="file">
31
+ <a href="README_rdoc.html">README</a>
32
+
33
+ <ul>
34
+ <li><a href="README_rdoc.html#label-Marked+Conductor">Marked Conductor</a>
35
+ </ul>
36
+ </li>
37
+ </ul>
38
+
39
+ <h2 id="classes">Classes and Modules</h2>
40
+ <ul>
41
+ <li class="class">
42
+ <a href="Array.html">Array</a>
43
+ </li>
44
+ <li class="module">
45
+ <a href="Conductor.html">Conductor</a>
46
+ </li>
47
+ <li class="class">
48
+ <a href="Conductor/Command.html">Conductor::Command</a>
49
+ </li>
50
+ <li class="class">
51
+ <a href="Conductor/Condition.html">Conductor::Condition</a>
52
+ </li>
53
+ <li class="class">
54
+ <a href="Conductor/Config.html">Conductor::Config</a>
55
+ </li>
56
+ <li class="module">
57
+ <a href="Conductor/Env.html">Conductor::Env</a>
58
+ </li>
59
+ <li class="class">
60
+ <a href="Conductor/Script.html">Conductor::Script</a>
61
+ </li>
62
+ <li class="class">
63
+ <a href="FalseClass.html">FalseClass</a>
64
+ </li>
65
+ <li class="class">
66
+ <a href="Hash.html">Hash</a>
67
+ </li>
68
+ <li class="class">
69
+ <a href="Object.html">Object</a>
70
+ </li>
71
+ <li class="class">
72
+ <a href="String.html">String</a>
73
+ </li>
74
+ <li class="class">
75
+ <a href="TrueClass.html">TrueClass</a>
76
+ </li>
77
+ </ul>
78
+
79
+ <h2 id="methods">Methods</h2>
80
+ <ul>
81
+
82
+ <li class="method">
83
+ <a href="Conductor.html#method-c-conduct">::conduct</a>
84
+ &mdash;
85
+ <span class="container">Conductor</span>
86
+
87
+ <li class="method">
88
+ <a href="Conductor/Env.html#method-c-env">::env</a>
89
+ &mdash;
90
+ <span class="container">Conductor::Env</span>
91
+
92
+ <li class="method">
93
+ <a href="Conductor.html#method-c-execute_track">::execute_track</a>
94
+ &mdash;
95
+ <span class="container">Conductor</span>
96
+
97
+ <li class="method">
98
+ <a href="Conductor/Env.html#method-c-load_test_env">::load_test_env</a>
99
+ &mdash;
100
+ <span class="container">Conductor::Env</span>
101
+
102
+ <li class="method">
103
+ <a href="Conductor/Script.html#method-c-new">::new</a>
104
+ &mdash;
105
+ <span class="container">Conductor::Script</span>
106
+
107
+ <li class="method">
108
+ <a href="Conductor/Config.html#method-c-new">::new</a>
109
+ &mdash;
110
+ <span class="container">Conductor::Config</span>
111
+
112
+ <li class="method">
113
+ <a href="Conductor/Command.html#method-c-new">::new</a>
114
+ &mdash;
115
+ <span class="container">Conductor::Command</span>
116
+
117
+ <li class="method">
118
+ <a href="Conductor/Condition.html#method-c-new">::new</a>
119
+ &mdash;
120
+ <span class="container">Conductor::Condition</span>
121
+
122
+ <li class="method">
123
+ <a href="Conductor.html#method-c-stdin">::stdin</a>
124
+ &mdash;
125
+ <span class="container">Conductor</span>
126
+
127
+ <li class="method">
128
+ <a href="Conductor/Env.html#method-c-to_s">::to_s</a>
129
+ &mdash;
130
+ <span class="container">Conductor::Env</span>
131
+
132
+ <li class="method">
133
+ <a href="Conductor/Command.html#method-i-args-3D">#args=</a>
134
+ &mdash;
135
+ <span class="container">Conductor::Command</span>
136
+
137
+ <li class="method">
138
+ <a href="Conductor/Script.html#method-i-args-3D">#args=</a>
139
+ &mdash;
140
+ <span class="container">Conductor::Script</span>
141
+
142
+ <li class="method">
143
+ <a href="String.html#method-i-bool-3F">#bool?</a>
144
+ &mdash;
145
+ <span class="container">String</span>
146
+
147
+ <li class="method">
148
+ <a href="FalseClass.html#method-i-bool-3F">#bool?</a>
149
+ &mdash;
150
+ <span class="container">FalseClass</span>
151
+
152
+ <li class="method">
153
+ <a href="TrueClass.html#method-i-bool-3F">#bool?</a>
154
+ &mdash;
155
+ <span class="container">TrueClass</span>
156
+
157
+ <li class="method">
158
+ <a href="String.html#method-i-bool_to_symbol">#bool_to_symbol</a>
159
+ &mdash;
160
+ <span class="container">String</span>
161
+
162
+ <li class="method">
163
+ <a href="Object.html#method-i-clean_condition">#clean_condition</a>
164
+ &mdash;
165
+ <span class="container">Object</span>
166
+
167
+ <li class="method">
168
+ <a href="Conductor.html#method-i-create_config">#create_config</a>
169
+ &mdash;
170
+ <span class="container">Conductor</span>
171
+
172
+ <li class="method">
173
+ <a href="String.html#method-i-date-3F">#date?</a>
174
+ &mdash;
175
+ <span class="container">String</span>
176
+
177
+ <li class="method">
178
+ <a href="String.html#method-i-meta-3F">#meta?</a>
179
+ &mdash;
180
+ <span class="container">String</span>
181
+
182
+ <li class="method">
183
+ <a href="String.html#method-i-number-3F">#number?</a>
184
+ &mdash;
185
+ <span class="container">String</span>
186
+
187
+ <li class="method">
188
+ <a href="Conductor/Condition.html#method-i-operator_to_symbol">#operator_to_symbol</a>
189
+ &mdash;
190
+ <span class="container">Conductor::Condition</span>
191
+
192
+ <li class="method">
193
+ <a href="Conductor/Condition.html#method-i-parse_condition">#parse_condition</a>
194
+ &mdash;
195
+ <span class="container">Conductor::Condition</span>
196
+
197
+ <li class="method">
198
+ <a href="Conductor/Command.html#method-i-path-3D">#path=</a>
199
+ &mdash;
200
+ <span class="container">Conductor::Command</span>
201
+
202
+ <li class="method">
203
+ <a href="Conductor/Script.html#method-i-path-3D">#path=</a>
204
+ &mdash;
205
+ <span class="container">Conductor::Script</span>
206
+
207
+ <li class="method">
208
+ <a href="Conductor/Script.html#method-i-run">#run</a>
209
+ &mdash;
210
+ <span class="container">Conductor::Script</span>
211
+
212
+ <li class="method">
213
+ <a href="Conductor/Command.html#method-i-run">#run</a>
214
+ &mdash;
215
+ <span class="container">Conductor::Command</span>
216
+
217
+ <li class="method">
218
+ <a href="Conductor.html#method-i-sample_config">#sample_config</a>
219
+ &mdash;
220
+ <span class="container">Conductor</span>
221
+
222
+ <li class="method">
223
+ <a href="Conductor/Condition.html#method-i-split_booleans">#split_booleans</a>
224
+ &mdash;
225
+ <span class="container">Conductor::Condition</span>
226
+
227
+ <li class="method">
228
+ <a href="Conductor/Condition.html#method-i-split_condition">#split_condition</a>
229
+ &mdash;
230
+ <span class="container">Conductor::Condition</span>
231
+
232
+ <li class="method">
233
+ <a href="String.html#method-i-strip_time">#strip_time</a>
234
+ &mdash;
235
+ <span class="container">String</span>
236
+
237
+ <li class="method">
238
+ <a href="Array.html#method-i-symbolize_keys">#symbolize_keys</a>
239
+ &mdash;
240
+ <span class="container">Array</span>
241
+
242
+ <li class="method">
243
+ <a href="Hash.html#method-i-symbolize_keys">#symbolize_keys</a>
244
+ &mdash;
245
+ <span class="container">Hash</span>
246
+
247
+ <li class="method">
248
+ <a href="Array.html#method-i-symbolize_keys-21">#symbolize_keys!</a>
249
+ &mdash;
250
+ <span class="container">Array</span>
251
+
252
+ <li class="method">
253
+ <a href="Hash.html#method-i-symbolize_keys-21">#symbolize_keys!</a>
254
+ &mdash;
255
+ <span class="container">Hash</span>
256
+
257
+ <li class="method">
258
+ <a href="Conductor/Condition.html#method-i-test_condition">#test_condition</a>
259
+ &mdash;
260
+ <span class="container">Conductor::Condition</span>
261
+
262
+ <li class="method">
263
+ <a href="Conductor/Condition.html#method-i-test_meta">#test_meta</a>
264
+ &mdash;
265
+ <span class="container">Conductor::Condition</span>
266
+
267
+ <li class="method">
268
+ <a href="Conductor/Condition.html#method-i-test_operator">#test_operator</a>
269
+ &mdash;
270
+ <span class="container">Conductor::Condition</span>
271
+
272
+ <li class="method">
273
+ <a href="Conductor/Condition.html#method-i-test_pandoc">#test_pandoc</a>
274
+ &mdash;
275
+ <span class="container">Conductor::Condition</span>
276
+
277
+ <li class="method">
278
+ <a href="Conductor/Condition.html#method-i-test_string">#test_string</a>
279
+ &mdash;
280
+ <span class="container">Conductor::Condition</span>
281
+
282
+ <li class="method">
283
+ <a href="Conductor/Condition.html#method-i-test_tree">#test_tree</a>
284
+ &mdash;
285
+ <span class="container">Conductor::Condition</span>
286
+
287
+ <li class="method">
288
+ <a href="Conductor/Condition.html#method-i-test_truthy">#test_truthy</a>
289
+ &mdash;
290
+ <span class="container">Conductor::Condition</span>
291
+
292
+ <li class="method">
293
+ <a href="Conductor/Condition.html#method-i-test_type">#test_type</a>
294
+ &mdash;
295
+ <span class="container">Conductor::Condition</span>
296
+
297
+ <li class="method">
298
+ <a href="Conductor/Condition.html#method-i-test_yaml">#test_yaml</a>
299
+ &mdash;
300
+ <span class="container">Conductor::Condition</span>
301
+
302
+ <li class="method">
303
+ <a href="String.html#method-i-time-3F">#time?</a>
304
+ &mdash;
305
+ <span class="container">String</span>
306
+
307
+ <li class="method">
308
+ <a href="String.html#method-i-to_bool">#to_bool</a>
309
+ &mdash;
310
+ <span class="container">String</span>
311
+
312
+ <li class="method">
313
+ <a href="String.html#method-i-to_bool-21">#to_bool!</a>
314
+ &mdash;
315
+ <span class="container">String</span>
316
+
317
+ <li class="method">
318
+ <a href="String.html#method-i-to_date">#to_date</a>
319
+ &mdash;
320
+ <span class="container">String</span>
321
+
322
+ <li class="method">
323
+ <a href="String.html#method-i-to_day">#to_day</a>
324
+ &mdash;
325
+ <span class="container">String</span>
326
+
327
+ <li class="method">
328
+ <a href="Conductor/Condition.html#method-i-true-3F">#true?</a>
329
+ &mdash;
330
+ <span class="container">Conductor::Condition</span>
331
+
332
+ <li class="method">
333
+ <a href="String.html#method-i-yaml-3F">#yaml?</a>
334
+ &mdash;
335
+ <span class="container">String</span>
336
+ </ul>
337
+ </main>
338
+
339
+
340
+ <footer id="validator-badges" role="contentinfo">
341
+ <p><a href="https://validator.w3.org/check/referer">Validate</a>
342
+ <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.6.2.
343
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
344
+ </footer>
345
+
@@ -2,17 +2,28 @@
2
2
 
3
3
  module Conductor
4
4
  class Condition
5
+
6
+ ##
7
+ ## Initializes the given condition.
8
+ ##
9
+ ## @param condition The condition
10
+ ##
5
11
  def initialize(condition)
6
12
  @condition = condition
7
13
  @env = Conductor::Env.env
8
14
  end
9
15
 
16
+ ##
17
+ ## Tests condition
18
+ ##
19
+ ## @return [Boolean] test result
20
+ ##
10
21
  def true?
11
22
  parse_condition
12
23
  end
13
24
 
14
25
  ##
15
- ## @brief Splits booleans and tests components.
26
+ ## Splits booleans and tests components.
16
27
  ##
17
28
  ## @param condition The condition to test
18
29
  ##
@@ -52,7 +63,7 @@ module Conductor
52
63
  end
53
64
 
54
65
  ##
55
- ## @brief Test operators
66
+ ## Test operators
56
67
  ##
57
68
  ## @param value1 Value
58
69
  ## @param value2 Value to test
@@ -80,7 +91,7 @@ module Conductor
80
91
  end
81
92
 
82
93
  ##
83
- ## @brief Splits a natural language condition.
94
+ ## Splits a natural language condition.
84
95
  ##
85
96
  ## @param condition The condition
86
97
  ## @return [Array] Value, value to compare, operator
@@ -105,7 +116,7 @@ module Conductor
105
116
  end
106
117
 
107
118
  ##
108
- ## @brief Test for type of value
119
+ ## Test for type of value
109
120
  ##
110
121
  ## @param val1 value
111
122
  ## @param val2 value to test against
@@ -130,7 +141,7 @@ module Conductor
130
141
  end
131
142
 
132
143
  ##
133
- ## @brief Compare a string based on operator
144
+ ## Compare a string based on operator
134
145
  ##
135
146
  ## @param val1 The string to test against
136
147
  ## @param val2 The value to test
@@ -194,7 +205,7 @@ module Conductor
194
205
  end
195
206
 
196
207
  ##
197
- ## @brief Test for the existince of a
208
+ ## Test for the existince of a
198
209
  ## file/directory in the parent tree
199
210
  ##
200
211
  ## @param origin Starting directory
@@ -219,7 +230,7 @@ module Conductor
219
230
  end
220
231
 
221
232
  ##
222
- ## @brief Test "truthiness"
233
+ ## Test "truthiness"
223
234
  ##
224
235
  ## @param value1 Value to test against
225
236
  ## @param value2 Value to test
@@ -238,7 +249,7 @@ module Conductor
238
249
  end
239
250
 
240
251
  ##
241
- ## @brief Test for presence of yaml, optionall for
252
+ ## Test for presence of yaml, optionall for
242
253
  ## a key, optionally for a key's value
243
254
  ##
244
255
  ## @param content Text content containing YAML
@@ -249,7 +260,11 @@ module Conductor
249
260
  ## @return [Boolean] test result
250
261
  ##
251
262
  def test_yaml(content, value, key, operator)
252
- yaml = YAML.safe_load(content.split(/^(?:---|\.\.\.)/)[1])
263
+ begin
264
+ yaml = YAML.load(content.split(/^(?:---|\.\.\.)/)[1])
265
+ rescue StandardError
266
+ return false
267
+ end
253
268
 
254
269
  return operator == :not_equal unless yaml
255
270
 
@@ -282,7 +297,7 @@ module Conductor
282
297
  end
283
298
 
284
299
  ##
285
- ## @brief Test for MultiMarkdown metadata,
300
+ ## Test for MultiMarkdown metadata,
286
301
  ## optionally key and value
287
302
  ##
288
303
  ## @param content [String] The text content