rslt 1.1.8
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +10 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +53 -0
- data/History.txt +4 -0
- data/PostInstall.txt +1 -0
- data/README.md +67 -0
- data/Rakefile +55 -0
- data/TODO +3 -0
- data/lib/rslt/element_wrapper.rb +37 -0
- data/lib/rslt/rule.rb +45 -0
- data/lib/rslt/stylesheet.rb +94 -0
- data/lib/rslt.rb +9 -0
- data/rdoc/RSLT/ElementWrapper.html +357 -0
- data/rdoc/RSLT/Rule.html +379 -0
- data/rdoc/RSLT/Stylesheet.html +311 -0
- data/rdoc/RSLT.html +132 -0
- data/rdoc/created.rid +6 -0
- data/rdoc/images/add.png +0 -0
- data/rdoc/images/brick.png +0 -0
- data/rdoc/images/brick_link.png +0 -0
- data/rdoc/images/bug.png +0 -0
- data/rdoc/images/bullet_black.png +0 -0
- data/rdoc/images/bullet_toggle_minus.png +0 -0
- data/rdoc/images/bullet_toggle_plus.png +0 -0
- data/rdoc/images/date.png +0 -0
- data/rdoc/images/delete.png +0 -0
- data/rdoc/images/find.png +0 -0
- data/rdoc/images/loadingAnimation.gif +0 -0
- data/rdoc/images/macFFBgHack.png +0 -0
- data/rdoc/images/package.png +0 -0
- data/rdoc/images/page_green.png +0 -0
- data/rdoc/images/page_white_text.png +0 -0
- data/rdoc/images/page_white_width.png +0 -0
- data/rdoc/images/plugin.png +0 -0
- data/rdoc/images/ruby.png +0 -0
- data/rdoc/images/tag_blue.png +0 -0
- data/rdoc/images/tag_green.png +0 -0
- data/rdoc/images/transparent.png +0 -0
- data/rdoc/images/wrench.png +0 -0
- data/rdoc/images/wrench_orange.png +0 -0
- data/rdoc/images/zoom.png +0 -0
- data/rdoc/index.html +75 -0
- data/rdoc/js/darkfish.js +153 -0
- data/rdoc/js/jquery.js +18 -0
- data/rdoc/js/navigation.js +142 -0
- data/rdoc/js/search.js +94 -0
- data/rdoc/js/search_index.js +1 -0
- data/rdoc/js/searcher.js +228 -0
- data/rdoc/rdoc.css +543 -0
- data/rdoc/table_of_contents.html +83 -0
- data/rslt.gemspec +150 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/spec/element_wrapper_spec.rb +22 -0
- data/spec/excesselt_spec.rb +112 -0
- data/spec/spec_helper.rb +6 -0
- data/spec/support/matchers/dom_matcher.rb +45 -0
- data/tasks/rspec.rake +13 -0
- metadata +307 -0
data/rdoc/RSLT/Rule.html
ADDED
@@ -0,0 +1,379 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
6
|
+
|
7
|
+
<title>class RSLT::Rule - <%= project_name %> 1.1.8</title>
|
8
|
+
|
9
|
+
<link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
|
10
|
+
|
11
|
+
<script type="text/javascript">
|
12
|
+
var rdoc_rel_prefix = "../";
|
13
|
+
</script>
|
14
|
+
|
15
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
16
|
+
<script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
|
17
|
+
<script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
|
18
|
+
<script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
|
19
|
+
<script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
|
20
|
+
<script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
|
21
|
+
|
22
|
+
|
23
|
+
<body id="top" class="class">
|
24
|
+
<nav id="metadata">
|
25
|
+
<nav id="home-section" class="section">
|
26
|
+
<h3 class="section-header">
|
27
|
+
<a href="../index.html">Home</a>
|
28
|
+
<a href="../table_of_contents.html#classes">Classes</a>
|
29
|
+
<a href="../table_of_contents.html#methods">Methods</a>
|
30
|
+
</h3>
|
31
|
+
</nav>
|
32
|
+
|
33
|
+
|
34
|
+
<nav id="search-section" class="section project-section" class="initially-hidden">
|
35
|
+
<form action="#" method="get" accept-charset="utf-8">
|
36
|
+
<h3 class="section-header">
|
37
|
+
<input type="text" name="search" placeholder="Search" id="search-field"
|
38
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
39
|
+
</h3>
|
40
|
+
</form>
|
41
|
+
|
42
|
+
<ul id="search-results" class="initially-hidden"></ul>
|
43
|
+
</nav>
|
44
|
+
|
45
|
+
|
46
|
+
<div id="file-metadata">
|
47
|
+
<nav id="file-list-section" class="section">
|
48
|
+
<h3 class="section-header">Defined In</h3>
|
49
|
+
<ul>
|
50
|
+
<li>lib/rslt/rule.rb
|
51
|
+
</ul>
|
52
|
+
</nav>
|
53
|
+
|
54
|
+
|
55
|
+
</div>
|
56
|
+
|
57
|
+
<div id="class-metadata">
|
58
|
+
|
59
|
+
<nav id="parent-class-section" class="section">
|
60
|
+
<h3 class="section-header">Parent</h3>
|
61
|
+
|
62
|
+
<p class="link">Object
|
63
|
+
|
64
|
+
</nav>
|
65
|
+
|
66
|
+
|
67
|
+
<!-- Method Quickref -->
|
68
|
+
<nav id="method-list-section" class="section">
|
69
|
+
<h3 class="section-header">Methods</h3>
|
70
|
+
|
71
|
+
<ul class="link-list">
|
72
|
+
|
73
|
+
<li><a href="#method-c-new">::new</a>
|
74
|
+
|
75
|
+
<li><a href="#method-i-applies_to_element-3F">#applies_to_element?</a>
|
76
|
+
|
77
|
+
<li><a href="#method-i-generate">#generate</a>
|
78
|
+
|
79
|
+
<li><a href="#method-i-matches-3F">#matches?</a>
|
80
|
+
|
81
|
+
<li><a href="#method-i-matching_elements">#matching_elements</a>
|
82
|
+
|
83
|
+
</ul>
|
84
|
+
</nav>
|
85
|
+
|
86
|
+
</div>
|
87
|
+
|
88
|
+
<div id="project-metadata">
|
89
|
+
|
90
|
+
<nav id="classindex-section" class="section project-section">
|
91
|
+
<h3 class="section-header">Class and Module Index</h3>
|
92
|
+
|
93
|
+
<ul class="link-list">
|
94
|
+
|
95
|
+
<li><a href="../RSLT.html">RSLT</a>
|
96
|
+
|
97
|
+
<li><a href="../RSLT/ElementWrapper.html">RSLT::ElementWrapper</a>
|
98
|
+
|
99
|
+
<li><a href="../RSLT/Rule.html">RSLT::Rule</a>
|
100
|
+
|
101
|
+
<li><a href="../RSLT/Stylesheet.html">RSLT::Stylesheet</a>
|
102
|
+
|
103
|
+
</ul>
|
104
|
+
</nav>
|
105
|
+
|
106
|
+
</div>
|
107
|
+
</nav>
|
108
|
+
|
109
|
+
<div id="documentation">
|
110
|
+
<h1 class="class">class RSLT::Rule</h1>
|
111
|
+
|
112
|
+
<div id="description" class="description">
|
113
|
+
|
114
|
+
</div><!-- description -->
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
<!-- Attributes -->
|
128
|
+
<section id="attribute-method-details" class="method-section section">
|
129
|
+
<h3 class="section-header">Attributes</h3>
|
130
|
+
|
131
|
+
|
132
|
+
<div id="attribute-i-block" class="method-detail">
|
133
|
+
<div class="method-heading attribute-method-heading">
|
134
|
+
<span class="method-name">block</span><span
|
135
|
+
class="attribute-access-type">[R]</span>
|
136
|
+
</div>
|
137
|
+
|
138
|
+
<div class="method-description">
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
</div>
|
143
|
+
</div>
|
144
|
+
|
145
|
+
<div id="attribute-i-element" class="method-detail">
|
146
|
+
<div class="method-heading attribute-method-heading">
|
147
|
+
<span class="method-name">element</span><span
|
148
|
+
class="attribute-access-type">[R]</span>
|
149
|
+
</div>
|
150
|
+
|
151
|
+
<div class="method-description">
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
</div>
|
156
|
+
</div>
|
157
|
+
|
158
|
+
<div id="attribute-i-selector" class="method-detail">
|
159
|
+
<div class="method-heading attribute-method-heading">
|
160
|
+
<span class="method-name">selector</span><span
|
161
|
+
class="attribute-access-type">[R]</span>
|
162
|
+
</div>
|
163
|
+
|
164
|
+
<div class="method-description">
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
</div>
|
169
|
+
</div>
|
170
|
+
|
171
|
+
<div id="attribute-i-stylesheet" class="method-detail">
|
172
|
+
<div class="method-heading attribute-method-heading">
|
173
|
+
<span class="method-name">stylesheet</span><span
|
174
|
+
class="attribute-access-type">[R]</span>
|
175
|
+
</div>
|
176
|
+
|
177
|
+
<div class="method-description">
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
</div>
|
182
|
+
</div>
|
183
|
+
|
184
|
+
</section><!-- attribute-method-details -->
|
185
|
+
|
186
|
+
|
187
|
+
<!-- Methods -->
|
188
|
+
|
189
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section section">
|
190
|
+
<h3 class="section-header">Public Class Methods</h3>
|
191
|
+
|
192
|
+
|
193
|
+
<div id="method-c-new" class="method-detail ">
|
194
|
+
|
195
|
+
<div class="method-heading">
|
196
|
+
<span class="method-name">new</span><span
|
197
|
+
class="method-args">(stylesheet, selector, extensions, &block)</span>
|
198
|
+
<span class="method-click-advice">click to toggle source</span>
|
199
|
+
</div>
|
200
|
+
|
201
|
+
|
202
|
+
<div class="method-description">
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
<div class="method-source-code" id="new-source">
|
209
|
+
<pre><span class="ruby-comment"># File lib/rslt/rule.rb, line 6</span>
|
210
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">stylesheet</span>, <span class="ruby-identifier">selector</span>, <span class="ruby-identifier">extensions</span>, &<span class="ruby-identifier">block</span>)
|
211
|
+
<span class="ruby-ivar">@stylesheet</span> = <span class="ruby-identifier">stylesheet</span>
|
212
|
+
<span class="ruby-ivar">@selector</span> = <span class="ruby-identifier">selector</span>
|
213
|
+
<span class="ruby-ivar">@extensions</span> = <span class="ruby-identifier">extensions</span>
|
214
|
+
<span class="ruby-ivar">@block</span> = <span class="ruby-identifier">block</span>
|
215
|
+
<span class="ruby-keyword">end</span></pre>
|
216
|
+
</div><!-- new-source -->
|
217
|
+
|
218
|
+
</div>
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
</div><!-- new-method -->
|
224
|
+
|
225
|
+
|
226
|
+
</section><!-- public-class-method-details -->
|
227
|
+
|
228
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
|
229
|
+
<h3 class="section-header">Public Instance Methods</h3>
|
230
|
+
|
231
|
+
|
232
|
+
<div id="method-i-applies_to_element-3F" class="method-detail ">
|
233
|
+
|
234
|
+
<div class="method-heading">
|
235
|
+
<span class="method-name">applies_to_element?</span><span
|
236
|
+
class="method-args">()</span>
|
237
|
+
<span class="method-click-advice">click to toggle source</span>
|
238
|
+
</div>
|
239
|
+
|
240
|
+
|
241
|
+
<div class="method-description">
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
<div class="method-source-code" id="applies_to_element-3F-source">
|
248
|
+
<pre><span class="ruby-comment"># File lib/rslt/rule.rb, line 18</span>
|
249
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">applies_to_element?</span>
|
250
|
+
<span class="ruby-identifier">matching_elements</span>(<span class="ruby-identifier">element</span>.<span class="ruby-identifier">document</span>).<span class="ruby-identifier">include?</span> <span class="ruby-identifier">element</span>
|
251
|
+
<span class="ruby-keyword">end</span></pre>
|
252
|
+
</div><!-- applies_to_element-3F-source -->
|
253
|
+
|
254
|
+
</div>
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
</div><!-- applies_to_element-3F-method -->
|
260
|
+
|
261
|
+
|
262
|
+
<div id="method-i-generate" class="method-detail ">
|
263
|
+
|
264
|
+
<div class="method-heading">
|
265
|
+
<span class="method-name">generate</span><span
|
266
|
+
class="method-args">(builder)</span>
|
267
|
+
<span class="method-click-advice">click to toggle source</span>
|
268
|
+
</div>
|
269
|
+
|
270
|
+
|
271
|
+
<div class="method-description">
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
<div class="method-source-code" id="generate-source">
|
278
|
+
<pre><span class="ruby-comment"># File lib/rslt/rule.rb, line 31</span>
|
279
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">generate</span>(<span class="ruby-identifier">builder</span>)
|
280
|
+
<span class="ruby-comment"># Call the block in the elements context</span>
|
281
|
+
<span class="ruby-identifier">wrapper</span> = <span class="ruby-constant">ElementWrapper</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">stylesheet</span>, <span class="ruby-identifier">element</span>, <span class="ruby-identifier">builder</span>)
|
282
|
+
<span class="ruby-ivar">@extensions</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span> <span class="ruby-identifier">wrapper</span>.<span class="ruby-identifier">extend</span> <span class="ruby-identifier">e</span> }
|
283
|
+
<span class="ruby-identifier">wrapper</span>.<span class="ruby-identifier">instance_eval</span>(&<span class="ruby-ivar">@block</span>)
|
284
|
+
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
285
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">message</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">%rWith selector '.*' and included modules/</span>
|
286
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-identifier">e</span>
|
287
|
+
<span class="ruby-keyword">else</span>
|
288
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">class</span>, <span class="ruby-node">"With selector '#{selector}' and included modules: #{@extensions.inspect}\n#{e.message}\n#{e.backtrace.join("\n")}"</span>
|
289
|
+
<span class="ruby-keyword">end</span>
|
290
|
+
<span class="ruby-keyword">end</span></pre>
|
291
|
+
</div><!-- generate-source -->
|
292
|
+
|
293
|
+
</div>
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
|
298
|
+
</div><!-- generate-method -->
|
299
|
+
|
300
|
+
|
301
|
+
<div id="method-i-matches-3F" class="method-detail ">
|
302
|
+
|
303
|
+
<div class="method-heading">
|
304
|
+
<span class="method-name">matches?</span><span
|
305
|
+
class="method-args">(element)</span>
|
306
|
+
<span class="method-click-advice">click to toggle source</span>
|
307
|
+
</div>
|
308
|
+
|
309
|
+
|
310
|
+
<div class="method-description">
|
311
|
+
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
|
316
|
+
<div class="method-source-code" id="matches-3F-source">
|
317
|
+
<pre><span class="ruby-comment"># File lib/rslt/rule.rb, line 22</span>
|
318
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">matches?</span>(<span class="ruby-identifier">element</span>)
|
319
|
+
<span class="ruby-ivar">@element</span> = <span class="ruby-identifier">element</span>
|
320
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">applies_to_element?</span>
|
321
|
+
<span class="ruby-keyword">self</span> <span class="ruby-comment"># if it matches, nil otherwise</span>
|
322
|
+
<span class="ruby-keyword">else</span>
|
323
|
+
<span class="ruby-keyword">nil</span>
|
324
|
+
<span class="ruby-keyword">end</span>
|
325
|
+
<span class="ruby-keyword">end</span></pre>
|
326
|
+
</div><!-- matches-3F-source -->
|
327
|
+
|
328
|
+
</div>
|
329
|
+
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
</div><!-- matches-3F-method -->
|
334
|
+
|
335
|
+
|
336
|
+
<div id="method-i-matching_elements" class="method-detail ">
|
337
|
+
|
338
|
+
<div class="method-heading">
|
339
|
+
<span class="method-name">matching_elements</span><span
|
340
|
+
class="method-args">(document)</span>
|
341
|
+
<span class="method-click-advice">click to toggle source</span>
|
342
|
+
</div>
|
343
|
+
|
344
|
+
|
345
|
+
<div class="method-description">
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
<div class="method-source-code" id="matching_elements-source">
|
352
|
+
<pre><span class="ruby-comment"># File lib/rslt/rule.rb, line 13</span>
|
353
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">matching_elements</span>(<span class="ruby-identifier">document</span>)
|
354
|
+
<span class="ruby-ivar">@selector_cache</span> <span class="ruby-operator">||=</span> {}
|
355
|
+
<span class="ruby-ivar">@selector_cache</span>[<span class="ruby-identifier">document</span>] <span class="ruby-operator">||=</span> <span class="ruby-identifier">document</span>.<span class="ruby-identifier">css</span>(<span class="ruby-ivar">@selector</span>)
|
356
|
+
<span class="ruby-keyword">end</span></pre>
|
357
|
+
</div><!-- matching_elements-source -->
|
358
|
+
|
359
|
+
</div>
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
|
364
|
+
</div><!-- matching_elements-method -->
|
365
|
+
|
366
|
+
|
367
|
+
</section><!-- public-instance-method-details -->
|
368
|
+
|
369
|
+
</section><!-- 5Buntitled-5D -->
|
370
|
+
|
371
|
+
</div><!-- documentation -->
|
372
|
+
|
373
|
+
|
374
|
+
<footer id="validator-badges">
|
375
|
+
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
376
|
+
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
|
377
|
+
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
378
|
+
</footer>
|
379
|
+
|