attrtastic 0.2.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +4 -20
- data/Gemfile +4 -0
- data/Gemfile.lock +50 -0
- data/LICENSE +1 -1
- data/README.md +16 -13
- data/Rakefile +6 -36
- data/attrtastic.gemspec +20 -76
- data/doc/Attrtastic/SemanticAttributesBuilder.html +340 -347
- data/doc/Attrtastic/SemanticAttributesHelper.html +100 -66
- data/doc/Attrtastic.html +29 -12
- data/doc/_index.html +9 -9
- data/doc/class_list.html +3 -3
- data/doc/css/full_list.css +6 -3
- data/doc/css/style.css +51 -9
- data/doc/file.README.html +21 -18
- data/doc/file_list.html +1 -1
- data/doc/frames.html +1 -1
- data/doc/index.html +21 -18
- data/doc/js/app.js +107 -4
- data/doc/js/full_list.js +78 -35
- data/doc/js/jquery.js +150 -15
- data/doc/method_list.html +7 -7
- data/doc/top-level-namespace.html +9 -6
- data/init.rb +2 -0
- data/lib/attrtastic/semantic_attributes_builder.rb +333 -0
- data/lib/attrtastic/semantic_attributes_helper.rb +55 -0
- data/lib/attrtastic/version.rb +3 -0
- data/lib/attrtastic.rb +2 -389
- data/rails/init.rb +1 -2
- data/test/helper.rb +2 -2
- data/test/test_attribute.rb +3 -5
- data/test/test_attributes.rb +26 -54
- data/test/test_attrtastic.rb +9 -8
- data/test/test_semantic_attributes_helper.rb +5 -8
- metadata +97 -32
- data/VERSION +0 -1
@@ -2,7 +2,7 @@
|
|
2
2
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
3
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
4
|
<head>
|
5
|
-
<meta name="Content-Type" content="text/html; charset=
|
5
|
+
<meta name="Content-Type" content="text/html; charset=utf-8" />
|
6
6
|
<title>Class: Attrtastic::SemanticAttributesBuilder</title>
|
7
7
|
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
8
8
|
<link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
@@ -24,7 +24,7 @@
|
|
24
24
|
<div id="menu">
|
25
25
|
|
26
26
|
<a href="../_index.html">Index (S)</a> »
|
27
|
-
<span class='title'><a href="../Attrtastic.html" title="Attrtastic (module)">Attrtastic</a></span>
|
27
|
+
<span class='title'><span class='object_link'><a href="../Attrtastic.html" title="Attrtastic (module)">Attrtastic</a></span></span>
|
28
28
|
»
|
29
29
|
<span class="title">SemanticAttributesBuilder</span>
|
30
30
|
|
@@ -43,7 +43,8 @@
|
|
43
43
|
|
44
44
|
<iframe id="search_frame"></iframe>
|
45
45
|
|
46
|
-
<div id="content"><h1>Class: Attrtastic::SemanticAttributesBuilder
|
46
|
+
<div id="content"><h1>Class: Attrtastic::SemanticAttributesBuilder
|
47
|
+
|
47
48
|
|
48
49
|
|
49
50
|
</h1>
|
@@ -71,15 +72,16 @@
|
|
71
72
|
|
72
73
|
|
73
74
|
|
75
|
+
|
74
76
|
<dt class="r2 last">Defined in:</dt>
|
75
|
-
<dd class="r2 last">lib/attrtastic.rb</dd>
|
77
|
+
<dd class="r2 last">lib/attrtastic/semantic_attributes_builder.rb</dd>
|
76
78
|
|
77
79
|
</dl>
|
78
80
|
<div class="clear"></div>
|
79
81
|
|
80
82
|
|
81
83
|
|
82
|
-
<h2>Instance Attribute Summary</h2>
|
84
|
+
<h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
|
83
85
|
<ul class="summary">
|
84
86
|
|
85
87
|
<li class="public ">
|
@@ -98,12 +100,13 @@
|
|
98
100
|
|
99
101
|
|
100
102
|
|
103
|
+
|
101
104
|
|
102
105
|
|
103
|
-
<span class="summary_desc">
|
106
|
+
<span class="summary_desc"><div class='inline'><p>
|
104
107
|
Only for testing purposes.
|
105
|
-
|
106
|
-
</span>
|
108
|
+
</p>
|
109
|
+
</div></span>
|
107
110
|
|
108
111
|
</li>
|
109
112
|
|
@@ -124,12 +127,13 @@ Only for testing purposes.
|
|
124
127
|
|
125
128
|
|
126
129
|
|
130
|
+
|
127
131
|
|
128
132
|
|
129
|
-
<span class="summary_desc">
|
133
|
+
<span class="summary_desc"><div class='inline'><p>
|
130
134
|
Only for testing purposes.
|
131
|
-
|
132
|
-
</span>
|
135
|
+
</p>
|
136
|
+
</div></span>
|
133
137
|
|
134
138
|
</li>
|
135
139
|
|
@@ -137,11 +141,15 @@ Only for testing purposes.
|
|
137
141
|
</ul>
|
138
142
|
|
139
143
|
|
140
|
-
|
144
|
+
|
145
|
+
<h2>
|
146
|
+
Instance Method Summary
|
147
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
148
|
+
</h2>
|
141
149
|
|
142
|
-
|
143
|
-
|
144
|
-
|
150
|
+
<ul class="summary">
|
151
|
+
|
152
|
+
<li class="public ">
|
145
153
|
<span class="summary_signature">
|
146
154
|
|
147
155
|
<a href="#attribute-instance_method" title="#attribute (instance method)">- (Object) <strong>attribute</strong>(*args, &block) </a>
|
@@ -154,17 +162,18 @@ Only for testing purposes.
|
|
154
162
|
|
155
163
|
|
156
164
|
|
165
|
+
|
157
166
|
|
158
167
|
|
159
|
-
<span class="summary_desc">
|
168
|
+
<span class="summary_desc"><div class='inline'><p>
|
160
169
|
Creates list entry for single record attribute.
|
161
|
-
|
162
|
-
</span>
|
170
|
+
</p>
|
171
|
+
</div></span>
|
163
172
|
|
164
173
|
</li>
|
165
174
|
|
166
|
-
|
167
|
-
|
175
|
+
|
176
|
+
<li class="public ">
|
168
177
|
<span class="summary_signature">
|
169
178
|
|
170
179
|
<a href="#attributes-instance_method" title="#attributes (instance method)">- (Object) <strong>attributes</strong>(*args, &block) </a>
|
@@ -177,17 +186,18 @@ Creates list entry for single record attribute.
|
|
177
186
|
|
178
187
|
|
179
188
|
|
189
|
+
|
180
190
|
|
181
191
|
|
182
|
-
<span class="summary_desc">
|
192
|
+
<span class="summary_desc"><div class='inline'><p>
|
183
193
|
Creates block of attributes with optional header.
|
184
|
-
|
185
|
-
</span>
|
194
|
+
</p>
|
195
|
+
</div></span>
|
186
196
|
|
187
197
|
</li>
|
188
198
|
|
189
|
-
|
190
|
-
|
199
|
+
|
200
|
+
<li class="public ">
|
191
201
|
<span class="summary_signature">
|
192
202
|
|
193
203
|
<a href="#initialize-instance_method" title="#initialize (instance method)">- (SemanticAttributesBuilder) <strong>initialize</strong>(record, template) </a>
|
@@ -202,24 +212,27 @@ Creates block of attributes with optional header.
|
|
202
212
|
|
203
213
|
|
204
214
|
|
215
|
+
|
205
216
|
|
206
217
|
|
207
|
-
<span class="summary_desc">
|
218
|
+
<span class="summary_desc"><div class='inline'><p>
|
208
219
|
A new instance of SemanticAttributesBuilder.
|
209
|
-
|
210
|
-
</span>
|
220
|
+
</p>
|
221
|
+
</div></span>
|
211
222
|
|
212
223
|
</li>
|
213
224
|
|
214
|
-
|
215
|
-
|
225
|
+
|
226
|
+
</ul>
|
227
|
+
|
228
|
+
|
216
229
|
<div id="constructor_details" class="method_details_list">
|
217
230
|
<h2>Constructor Details</h2>
|
218
231
|
|
219
232
|
<div class="method_details first">
|
220
233
|
<p class="signature first" id="initialize-instance_method">
|
221
234
|
|
222
|
-
- (<tt><a href="" title="Attrtastic::SemanticAttributesBuilder (class)">SemanticAttributesBuilder</a></tt>) <strong>initialize</strong>(record, template)
|
235
|
+
- (<tt><span class='object_link'><a href="" title="Attrtastic::SemanticAttributesBuilder (class)">SemanticAttributesBuilder</a></span></tt>) <strong>initialize</strong>(record, template)
|
223
236
|
|
224
237
|
|
225
238
|
|
@@ -240,12 +253,12 @@ A new instance of SemanticAttributesBuilder
|
|
240
253
|
<pre class="lines">
|
241
254
|
|
242
255
|
|
243
|
-
|
244
|
-
|
245
|
-
|
256
|
+
9
|
257
|
+
10
|
258
|
+
11</pre>
|
246
259
|
</td>
|
247
260
|
<td>
|
248
|
-
<pre class="code"><span class="info file"># File 'lib/attrtastic.rb', line
|
261
|
+
<pre class="code"><span class="info file"># File 'lib/attrtastic/semantic_attributes_builder.rb', line 9</span>
|
249
262
|
|
250
263
|
<span class='kw'>def</span> <span class='id initialize'>initialize</span><span class='lparen'>(</span><span class='id record'>record</span><span class='comma'>,</span> <span class='id template'>template</span><span class='rparen'>)</span>
|
251
264
|
<span class='ivar'>@record</span><span class='comma'>,</span> <span class='ivar'>@template</span> <span class='op'>=</span> <span class='id record'>record</span><span class='comma'>,</span> <span class='id template'>template</span>
|
@@ -287,12 +300,12 @@ Only for testing purposes
|
|
287
300
|
<pre class="lines">
|
288
301
|
|
289
302
|
|
290
|
-
|
291
|
-
|
292
|
-
|
303
|
+
7
|
304
|
+
8
|
305
|
+
9</pre>
|
293
306
|
</td>
|
294
307
|
<td>
|
295
|
-
<pre class="code"><span class="info file"># File 'lib/attrtastic.rb', line
|
308
|
+
<pre class="code"><span class="info file"># File 'lib/attrtastic/semantic_attributes_builder.rb', line 7</span>
|
296
309
|
|
297
310
|
<span class='kw'>def</span> <span class='id record'>record</span>
|
298
311
|
<span class='ivar'>@record</span>
|
@@ -329,12 +342,12 @@ Only for testing purposes
|
|
329
342
|
<pre class="lines">
|
330
343
|
|
331
344
|
|
332
|
-
|
333
|
-
|
334
|
-
|
345
|
+
7
|
346
|
+
8
|
347
|
+
9</pre>
|
335
348
|
</td>
|
336
349
|
<td>
|
337
|
-
<pre class="code"><span class="info file"># File 'lib/attrtastic.rb', line
|
350
|
+
<pre class="code"><span class="info file"># File 'lib/attrtastic/semantic_attributes_builder.rb', line 7</span>
|
338
351
|
|
339
352
|
<span class='kw'>def</span> <span class='id template'>template</span>
|
340
353
|
<span class='ivar'>@template</span>
|
@@ -357,9 +370,9 @@ Only for testing purposes
|
|
357
370
|
|
358
371
|
<span class="overload">- (<tt>Object</tt>) <strong>attribute</strong>(method, options = {}) </span>
|
359
372
|
|
360
|
-
<span class="overload">- (<tt>Object</tt>) <strong>attribute</strong>(method, options = {}
|
373
|
+
<span class="overload">- (<tt>Object</tt>) <strong>attribute</strong>(method, options = {}) { ... }</span>
|
361
374
|
|
362
|
-
<span class="overload">- (<tt>Object</tt>) <strong>attribute</strong>(options = {}
|
375
|
+
<span class="overload">- (<tt>Object</tt>) <strong>attribute</strong>(options = {}) { ... }</span>
|
363
376
|
|
364
377
|
|
365
378
|
|
@@ -378,12 +391,12 @@ Creates list entry for single record attribute
|
|
378
391
|
<div class="examples">
|
379
392
|
<h3>Examples:</h3>
|
380
393
|
|
381
|
-
<h4></h4>
|
382
|
-
<pre class="example code"
|
394
|
+
<h4><div class='inline'></div></h4>
|
395
|
+
<pre class="example code"><%= attr.attribute :name, :display_empty => true %></pre>
|
383
396
|
|
384
|
-
<h4></h4>
|
385
|
-
<pre class="example code"
|
386
|
-
|
397
|
+
<h4><div class='inline'></div></h4>
|
398
|
+
<pre class="example code"><%= attr.attribute :label => "User link" do %>
|
399
|
+
<%= link_to @user.full_name, user_path(@user) %></pre>
|
387
400
|
|
388
401
|
</div>
|
389
402
|
|
@@ -407,14 +420,14 @@ Creates entry for record attribute
|
|
407
420
|
<div class="examples">
|
408
421
|
<h3>Examples:</h3>
|
409
422
|
|
410
|
-
<h4></h4>
|
411
|
-
<pre class="example code"
|
423
|
+
<h4><div class='inline'></div></h4>
|
424
|
+
<pre class="example code"><%= attr.attribute :name %></pre>
|
412
425
|
|
413
|
-
<h4></h4>
|
414
|
-
<pre class="example code"
|
426
|
+
<h4><div class='inline'></div></h4>
|
427
|
+
<pre class="example code"><%= attr.attribute :name, :label => "Full user name" %></pre>
|
415
428
|
|
416
|
-
<h4></h4>
|
417
|
-
<pre class="example code"
|
429
|
+
<h4><div class='inline'></div></h4>
|
430
|
+
<pre class="example code"><%= attr.attribute :name, :value => @user.full_name %></pre>
|
418
431
|
|
419
432
|
</div>
|
420
433
|
<h3>Parameters:</h3>
|
@@ -430,10 +443,10 @@ Creates entry for record attribute
|
|
430
443
|
|
431
444
|
|
432
445
|
—
|
433
|
-
|
446
|
+
<div class='inline'><p>
|
434
447
|
Attribute name of given record
|
435
|
-
|
436
|
-
|
448
|
+
</p>
|
449
|
+
</div>
|
437
450
|
|
438
451
|
</li>
|
439
452
|
|
@@ -447,10 +460,10 @@ Attribute name of given record
|
|
447
460
|
|
448
461
|
|
449
462
|
—
|
450
|
-
|
463
|
+
<div class='inline'><p>
|
451
464
|
Options
|
452
|
-
|
453
|
-
|
465
|
+
</p>
|
466
|
+
</div>
|
454
467
|
|
455
468
|
</li>
|
456
469
|
|
@@ -473,11 +486,11 @@ Options
|
|
473
486
|
<tt>{}</tt>
|
474
487
|
|
475
488
|
</span>
|
476
|
-
—
|
489
|
+
— <div class='inline'><p>
|
477
490
|
Hash with optional :class, :label_class and :value_class names of class for
|
478
491
|
html
|
479
|
-
|
480
|
-
|
492
|
+
</p>
|
493
|
+
</div>
|
481
494
|
</tr>
|
482
495
|
|
483
496
|
<li>
|
@@ -485,13 +498,11 @@ html
|
|
485
498
|
<span class="name">:label</span>
|
486
499
|
<span class="default">
|
487
500
|
|
488
|
-
<span class="na">N/A</span>
|
489
|
-
|
490
501
|
</span>
|
491
|
-
—
|
502
|
+
— <div class='inline'><p>
|
492
503
|
Label for attribute entry, overrides default label name from symbol
|
493
|
-
|
494
|
-
|
504
|
+
</p>
|
505
|
+
</div>
|
495
506
|
</tr>
|
496
507
|
|
497
508
|
<li>
|
@@ -499,13 +510,11 @@ Label for attribute entry, overrides default label name from symbol
|
|
499
510
|
<span class="name">:value</span>
|
500
511
|
<span class="default">
|
501
512
|
|
502
|
-
<span class="na">N/A</span>
|
503
|
-
|
504
513
|
</span>
|
505
|
-
—
|
514
|
+
— <div class='inline'><p>
|
506
515
|
Value of attribute entry, overrides default value from record
|
507
|
-
|
508
|
-
|
516
|
+
</p>
|
517
|
+
</div>
|
509
518
|
</tr>
|
510
519
|
|
511
520
|
<li>
|
@@ -517,10 +526,10 @@ Value of attribute entry, overrides default value from record
|
|
517
526
|
<tt>false</tt>
|
518
527
|
|
519
528
|
</span>
|
520
|
-
—
|
529
|
+
— <div class='inline'><p>
|
521
530
|
Indicates if print value of given attribute even if it is blank?
|
522
|
-
|
523
|
-
|
531
|
+
</p>
|
532
|
+
</div>
|
524
533
|
</tr>
|
525
534
|
|
526
535
|
</ul>
|
@@ -531,7 +540,7 @@ Indicates if print value of given attribute even if it is blank?
|
|
531
540
|
|
532
541
|
|
533
542
|
<li class="overload_item">
|
534
|
-
<span class="signature">- (<tt>Object</tt>) <strong>attribute</strong>(method, options = {}
|
543
|
+
<span class="signature">- (<tt>Object</tt>) <strong>attribute</strong>(method, options = {}) { ... }</span>
|
535
544
|
<div class="docstring">
|
536
545
|
<div class="discussion">
|
537
546
|
<p>
|
@@ -546,9 +555,9 @@ Creates entry for attribute given with block
|
|
546
555
|
<div class="examples">
|
547
556
|
<h3>Examples:</h3>
|
548
557
|
|
549
|
-
<h4></h4>
|
550
|
-
<pre class="example code"
|
551
|
-
|
558
|
+
<h4><div class='inline'></div></h4>
|
559
|
+
<pre class="example code"><%= attr.attribute :name do %>
|
560
|
+
<%= link_to @user.full_name, user_path(@user) %></pre>
|
552
561
|
|
553
562
|
</div>
|
554
563
|
<h3>Parameters:</h3>
|
@@ -564,10 +573,10 @@ Creates entry for attribute given with block
|
|
564
573
|
|
565
574
|
|
566
575
|
—
|
567
|
-
|
576
|
+
<div class='inline'><p>
|
568
577
|
Attribute name of given record
|
569
|
-
|
570
|
-
|
578
|
+
</p>
|
579
|
+
</div>
|
571
580
|
|
572
581
|
</li>
|
573
582
|
|
@@ -581,10 +590,10 @@ Attribute name of given record
|
|
581
590
|
|
582
591
|
|
583
592
|
—
|
584
|
-
|
593
|
+
<div class='inline'><p>
|
585
594
|
Options
|
586
|
-
|
587
|
-
|
595
|
+
</p>
|
596
|
+
</div>
|
588
597
|
|
589
598
|
</li>
|
590
599
|
|
@@ -607,11 +616,11 @@ Options
|
|
607
616
|
<tt>{}</tt>
|
608
617
|
|
609
618
|
</span>
|
610
|
-
—
|
619
|
+
— <div class='inline'><p>
|
611
620
|
Hash with optional :class, :label_class and :value_class names of classes
|
612
621
|
for html
|
613
|
-
|
614
|
-
|
622
|
+
</p>
|
623
|
+
</div>
|
615
624
|
</tr>
|
616
625
|
|
617
626
|
<li>
|
@@ -619,19 +628,15 @@ for html
|
|
619
628
|
<span class="name">:label</span>
|
620
629
|
<span class="default">
|
621
630
|
|
622
|
-
<span class="na">N/A</span>
|
623
|
-
|
624
631
|
</span>
|
625
|
-
—
|
632
|
+
— <div class='inline'><p>
|
626
633
|
Label for attribute entry, overrides default label name from symbol
|
627
|
-
|
628
|
-
|
634
|
+
</p>
|
635
|
+
</div>
|
629
636
|
</tr>
|
630
637
|
|
631
638
|
</ul>
|
632
639
|
|
633
|
-
|
634
|
-
|
635
640
|
<h3>Yields:</h3>
|
636
641
|
<ul class="yield">
|
637
642
|
|
@@ -643,10 +648,10 @@ Label for attribute entry, overrides default label name from symbol
|
|
643
648
|
|
644
649
|
|
645
650
|
|
646
|
-
|
651
|
+
<div class='inline'><p>
|
647
652
|
Block which is executed in place of value for attribute
|
648
|
-
|
649
|
-
|
653
|
+
</p>
|
654
|
+
</div>
|
650
655
|
|
651
656
|
</li>
|
652
657
|
|
@@ -657,7 +662,7 @@ Block which is executed in place of value for attribute
|
|
657
662
|
|
658
663
|
|
659
664
|
<li class="overload_item">
|
660
|
-
<span class="signature">- (<tt>Object</tt>) <strong>attribute</strong>(options = {}
|
665
|
+
<span class="signature">- (<tt>Object</tt>) <strong>attribute</strong>(options = {}) { ... }</span>
|
661
666
|
<div class="docstring">
|
662
667
|
<div class="discussion">
|
663
668
|
<p>
|
@@ -673,9 +678,9 @@ in this case.
|
|
673
678
|
<div class="examples">
|
674
679
|
<h3>Examples:</h3>
|
675
680
|
|
676
|
-
<h4></h4>
|
677
|
-
<pre class="example code"
|
678
|
-
|
681
|
+
<h4><div class='inline'></div></h4>
|
682
|
+
<pre class="example code"><%= attr.attribute :label => "User link" do %>
|
683
|
+
<%= link_to @user.full_name, user_path(@user) %></pre>
|
679
684
|
|
680
685
|
</div>
|
681
686
|
<h3>Parameters:</h3>
|
@@ -691,10 +696,10 @@ in this case.
|
|
691
696
|
|
692
697
|
|
693
698
|
—
|
694
|
-
|
699
|
+
<div class='inline'><p>
|
695
700
|
Options
|
696
|
-
|
697
|
-
|
701
|
+
</p>
|
702
|
+
</div>
|
698
703
|
|
699
704
|
</li>
|
700
705
|
|
@@ -715,11 +720,11 @@ Options
|
|
715
720
|
<tt>{}</tt>
|
716
721
|
|
717
722
|
</span>
|
718
|
-
—
|
723
|
+
— <div class='inline'><p>
|
719
724
|
Hash with optional :class, :label_class and :value_class names of classes
|
720
725
|
for html
|
721
|
-
|
722
|
-
|
726
|
+
</p>
|
727
|
+
</div>
|
723
728
|
</tr>
|
724
729
|
|
725
730
|
<li>
|
@@ -727,19 +732,15 @@ for html
|
|
727
732
|
<span class="name">:label</span>
|
728
733
|
<span class="default">
|
729
734
|
|
730
|
-
<span class="na">N/A</span>
|
731
|
-
|
732
735
|
</span>
|
733
|
-
—
|
736
|
+
— <div class='inline'><p>
|
734
737
|
Mandatory label for attribute entry
|
735
|
-
|
736
|
-
|
738
|
+
</p>
|
739
|
+
</div>
|
737
740
|
</tr>
|
738
741
|
|
739
742
|
</ul>
|
740
743
|
|
741
|
-
|
742
|
-
|
743
744
|
<h3>Yields:</h3>
|
744
745
|
<ul class="yield">
|
745
746
|
|
@@ -751,10 +752,10 @@ Mandatory label for attribute entry
|
|
751
752
|
|
752
753
|
|
753
754
|
|
754
|
-
|
755
|
+
<div class='inline'><p>
|
755
756
|
Block which is executed in place of value for attribute
|
756
|
-
|
757
|
-
|
757
|
+
</p>
|
758
|
+
</div>
|
758
759
|
|
759
760
|
</li>
|
760
761
|
|
@@ -771,6 +772,12 @@ Block which is executed in place of value for attribute
|
|
771
772
|
<pre class="lines">
|
772
773
|
|
773
774
|
|
775
|
+
255
|
776
|
+
256
|
777
|
+
257
|
778
|
+
258
|
779
|
+
259
|
780
|
+
260
|
774
781
|
261
|
775
782
|
262
|
776
783
|
263
|
@@ -794,27 +801,13 @@ Block which is executed in place of value for attribute
|
|
794
801
|
281
|
795
802
|
282
|
796
803
|
283
|
797
|
-
284
|
798
|
-
285
|
799
|
-
286
|
800
|
-
287
|
801
|
-
288
|
802
|
-
289
|
803
|
-
290
|
804
|
-
291
|
805
|
-
292
|
806
|
-
293
|
807
|
-
294</pre>
|
804
|
+
284</pre>
|
808
805
|
</td>
|
809
806
|
<td>
|
810
|
-
<pre class="code"><span class="info file"># File 'lib/attrtastic.rb', line
|
807
|
+
<pre class="code"><span class="info file"># File 'lib/attrtastic/semantic_attributes_builder.rb', line 255</span>
|
811
808
|
|
812
809
|
<span class='kw'>def</span> <span class='id attribute'>attribute</span><span class='lparen'>(</span><span class='op'>*</span><span class='id args'>args</span><span class='comma'>,</span> <span class='op'>&</span><span class='id block'>block</span><span class='rparen'>)</span>
|
813
|
-
<span class='id options'>options</span> <span class='op'>=</span> <span class='
|
814
|
-
<span class='kw'>if</span> <span class='id args'>args</span><span class='period'>.</span><span class='id last'>last</span> <span class='kw'>and</span> <span class='id args'>args</span><span class='period'>.</span><span class='id last'>last</span><span class='period'>.</span><span class='id kind_of?'>kind_of?</span> <span class='const'>Hash</span>
|
815
|
-
<span class='id options'>options</span> <span class='op'>=</span> <span class='id args'>args</span><span class='period'>.</span><span class='id last'>last</span>
|
816
|
-
<span class='id args'>args</span> <span class='op'>=</span> <span class='id args'>args</span><span class='lbracket'>[</span><span class='int'>0</span> <span class='op'>..</span> <span class='op'>-</span><span class='int'>2</span><span class='rbracket'>]</span>
|
817
|
-
<span class='kw'>end</span>
|
810
|
+
<span class='id options'>options</span> <span class='op'>=</span> <span class='id args'>args</span><span class='period'>.</span><span class='id extract_options!'>extract_options!</span>
|
818
811
|
<span class='id options'>options</span><span class='lbracket'>[</span><span class='symbol'>:html</span><span class='rbracket'>]</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
819
812
|
|
820
813
|
<span class='id method'>method</span> <span class='op'>=</span> <span class='id args'>args</span><span class='period'>.</span><span class='id shift'>shift</span>
|
@@ -824,23 +817,23 @@ Block which is executed in place of value for attribute
|
|
824
817
|
<span class='id html_class'>html_class</span> <span class='op'>=</span> <span class='lbracket'>[</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>attribute</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id options'>options</span><span class='lbracket'>[</span><span class='symbol'>:html</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:class</span><span class='rbracket'>]</span> <span class='rbracket'>]</span><span class='period'>.</span><span class='id compact'>compact</span><span class='period'>.</span><span class='id join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'> </span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
825
818
|
|
826
819
|
<span class='id label'>label</span> <span class='op'>=</span> <span class='id options'>options</span><span class='period'>.</span><span class='id key?'>key?</span><span class='lparen'>(</span><span class='symbol'>:label</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id options'>options</span><span class='lbracket'>[</span><span class='symbol'>:label</span><span class='rbracket'>]</span> <span class='op'>:</span> <span class='id label_for_attribute'>label_for_attribute</span><span class='lparen'>(</span><span class='id method'>method</span><span class='rparen'>)</span>
|
827
|
-
<span class='id label_content'>label_content</span> <span class='op'>=</span> <span class='id template'>template</span><span class='period'>.</span><span class='id content_tag'>content_tag</span><span class='lparen'>(</span><span class='symbol'>:span</span><span class='comma'>,</span> <span class='id label'>label</span><span class='comma'>,</span> <span class='symbol'>:class</span> <span class='op'>=></span> <span class='id html_label_class'>html_label_class</span><span class='rparen'>)</span>
|
828
820
|
|
829
821
|
<span class='kw'>unless</span> <span class='id block_given?'>block_given?</span>
|
830
822
|
<span class='id value'>value</span> <span class='op'>=</span> <span class='id options'>options</span><span class='period'>.</span><span class='id key?'>key?</span><span class='lparen'>(</span><span class='symbol'>:value</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id options'>options</span><span class='lbracket'>[</span><span class='symbol'>:value</span><span class='rbracket'>]</span> <span class='op'>:</span> <span class='id value_of_attribute'>value_of_attribute</span><span class='lparen'>(</span><span class='id method'>method</span><span class='rparen'>)</span>
|
831
|
-
<span class='id value_content'>value_content</span> <span class='op'>=</span> <span class='id template'>template</span><span class='period'>.</span><span class='id content_tag'>content_tag</span><span class='lparen'>(</span><span class='symbol'>:span</span><span class='comma'>,</span> <span class='id value'>value</span><span class='comma'>,</span> <span class='symbol'>:class</span> <span class='op'>=></span> <span class='id html_value_class'>html_value_class</span><span class='rparen'>)</span>
|
832
823
|
|
833
824
|
<span class='kw'>if</span> <span class='id value'>value</span><span class='period'>.</span><span class='id present?'>present?</span> <span class='kw'>or</span> <span class='id options'>options</span><span class='lbracket'>[</span><span class='symbol'>:display_empty</span><span class='rbracket'>]</span>
|
834
|
-
<span class='id
|
835
|
-
<span class='id template'>template</span><span class='period'>.</span><span class='id content_tag'>content_tag</span><span class='lparen'>(</span><span class='symbol'>:
|
825
|
+
<span class='id output'>output</span> <span class='op'>=</span> <span class='id template'>template</span><span class='period'>.</span><span class='id tag'>tag</span><span class='lparen'>(</span><span class='symbol'>:li</span><span class='comma'>,</span> <span class='lbrace'>{</span><span class='symbol'>:class</span> <span class='op'>=></span> <span class='id html_class'>html_class</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
826
|
+
<span class='id output'>output</span> <span class='op'><<</span> <span class='id template'>template</span><span class='period'>.</span><span class='id content_tag'>content_tag</span><span class='lparen'>(</span><span class='symbol'>:span</span><span class='comma'>,</span> <span class='id label'>label</span><span class='comma'>,</span> <span class='symbol'>:class</span> <span class='op'>=></span> <span class='id html_label_class'>html_label_class</span><span class='rparen'>)</span>
|
827
|
+
<span class='id output'>output</span> <span class='op'><<</span> <span class='id template'>template</span><span class='period'>.</span><span class='id content_tag'>content_tag</span><span class='lparen'>(</span><span class='symbol'>:span</span><span class='comma'>,</span> <span class='id value'>value</span><span class='comma'>,</span> <span class='symbol'>:class</span> <span class='op'>=></span> <span class='id html_value_class'>html_value_class</span><span class='rparen'>)</span>
|
828
|
+
<span class='id output'>output</span><span class='period'>.</span><span class='id safe_concat'>safe_concat</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'></li></span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
836
829
|
<span class='kw'>end</span>
|
837
830
|
<span class='kw'>else</span>
|
838
|
-
<span class='id
|
839
|
-
<span class='id template'>template</span><span class='period'>.</span><span class='id
|
840
|
-
<span class='id
|
841
|
-
<span class='
|
842
|
-
<span class='id
|
843
|
-
<span class='id
|
831
|
+
<span class='id output'>output</span> <span class='op'>=</span> <span class='id template'>template</span><span class='period'>.</span><span class='id tag'>tag</span><span class='lparen'>(</span><span class='symbol'>:li</span><span class='comma'>,</span> <span class='lbrace'>{</span><span class='symbol'>:class</span> <span class='op'>=></span> <span class='id html_class'>html_class</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
832
|
+
<span class='id output'>output</span> <span class='op'><<</span> <span class='id template'>template</span><span class='period'>.</span><span class='id content_tag'>content_tag</span><span class='lparen'>(</span><span class='symbol'>:span</span><span class='comma'>,</span> <span class='id label'>label</span><span class='comma'>,</span> <span class='symbol'>:class</span> <span class='op'>=></span> <span class='id html_label_class'>html_label_class</span><span class='rparen'>)</span>
|
833
|
+
<span class='id output'>output</span> <span class='op'><<</span> <span class='id template'>template</span><span class='period'>.</span><span class='id tag'>tag</span><span class='lparen'>(</span><span class='symbol'>:span</span><span class='comma'>,</span> <span class='lbrace'>{</span><span class='symbol'>:class</span> <span class='op'>=></span> <span class='id html_value_class'>html_value_class</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
834
|
+
<span class='id output'>output</span> <span class='op'><<</span> <span class='id template'>template</span><span class='period'>.</span><span class='id capture'>capture</span><span class='lparen'>(</span><span class='op'>&</span><span class='id block'>block</span><span class='rparen'>)</span>
|
835
|
+
<span class='id output'>output</span><span class='period'>.</span><span class='id safe_concat'>safe_concat</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'></span></span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
836
|
+
<span class='id output'>output</span><span class='period'>.</span><span class='id safe_concat'>safe_concat</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'></li></span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
844
837
|
<span class='kw'>end</span>
|
845
838
|
<span class='kw'>end</span></pre>
|
846
839
|
</td>
|
@@ -852,9 +845,9 @@ Block which is executed in place of value for attribute
|
|
852
845
|
<p class="signature " id="attributes-instance_method">
|
853
846
|
|
854
847
|
|
855
|
-
<span class="overload">- (<tt>Object</tt>) <strong>attributes</strong>(options = {}
|
848
|
+
<span class="overload">- (<tt>Object</tt>) <strong>attributes</strong>(options = {}) { ... }</span>
|
856
849
|
|
857
|
-
<span class="overload">- (<tt>Object</tt>) <strong>attributes</strong>(header, options = {}
|
850
|
+
<span class="overload">- (<tt>Object</tt>) <strong>attributes</strong>(header, options = {}) {|builder| ... }</span>
|
858
851
|
|
859
852
|
<span class="overload">- (<tt>Object</tt>) <strong>attributes</strong>(*symbols, options = {}) </span>
|
860
853
|
|
@@ -878,20 +871,20 @@ with ordered list.
|
|
878
871
|
<div class="examples">
|
879
872
|
<h3>Examples:</h3>
|
880
873
|
|
881
|
-
<h4>
|
874
|
+
<h4><div class='inline'><p>
|
882
875
|
All together
|
883
|
-
|
884
|
-
</h4>
|
885
|
-
<pre class="example code"
|
876
|
+
</p>
|
877
|
+
</div></h4>
|
878
|
+
<pre class="example code"><%= attr.attributes "User info", :name, :email, :class => "user_info", :header_class => "header important" %></pre>
|
886
879
|
|
887
|
-
<h4>
|
880
|
+
<h4><div class='inline'><p>
|
888
881
|
With block
|
889
|
-
|
890
|
-
</h4>
|
891
|
-
<pre class="example code"
|
892
|
-
|
893
|
-
|
894
|
-
|
882
|
+
</p>
|
883
|
+
</div></h4>
|
884
|
+
<pre class="example code"><%= attr.attributes "User info" :class => "user_info", :header_class => "header important" do %>
|
885
|
+
<%= attr.attribute :name %>
|
886
|
+
<%= attr.attribute :email %>
|
887
|
+
<% end %></pre>
|
895
888
|
|
896
889
|
</div>
|
897
890
|
|
@@ -900,7 +893,7 @@ With block
|
|
900
893
|
|
901
894
|
|
902
895
|
<li class="overload_item">
|
903
|
-
<span class="signature">- (<tt>Object</tt>) <strong>attributes</strong>(options = {}
|
896
|
+
<span class="signature">- (<tt>Object</tt>) <strong>attributes</strong>(options = {}) { ... }</span>
|
904
897
|
<div class="docstring">
|
905
898
|
<div class="discussion">
|
906
899
|
<p>
|
@@ -916,47 +909,47 @@ attribute
|
|
916
909
|
<div class="examples">
|
917
910
|
<h3>Examples:</h3>
|
918
911
|
|
919
|
-
<h4></h4>
|
920
|
-
<pre class="example code"
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
<h4></h4>
|
926
|
-
<pre class="example code"
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
<h4></h4>
|
932
|
-
<pre class="example code"
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
<h4></h4>
|
941
|
-
<pre class="example code"
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
<h4></h4>
|
950
|
-
<pre class="example code"
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
<h4></h4>
|
956
|
-
<pre class="example code"
|
957
|
-
|
958
|
-
|
959
|
-
|
912
|
+
<h4><div class='inline'></div></h4>
|
913
|
+
<pre class="example code"><%= attr.attributes do %>
|
914
|
+
<%= attr.attribute :name %>
|
915
|
+
<%= attr.attribute :email %>
|
916
|
+
<% end %></pre>
|
917
|
+
|
918
|
+
<h4><div class='inline'></div></h4>
|
919
|
+
<pre class="example code"><%= attr.attributes :name => "User" do %>
|
920
|
+
<%= attr.attribute :name %>
|
921
|
+
<%= attr.attribute :email %>
|
922
|
+
<% end %></pre>
|
923
|
+
|
924
|
+
<h4><div class='inline'></div></h4>
|
925
|
+
<pre class="example code"><%= attr.attributes :for => :user do |user| %>
|
926
|
+
<%= user.attribute :name %>
|
927
|
+
<%= user.attribute :email %>
|
928
|
+
<%= user.attribute :profile do %>
|
929
|
+
<%= link_to h(user.record.name), user_path(user.record) %>
|
930
|
+
<% end %>
|
931
|
+
<% end %></pre>
|
932
|
+
|
933
|
+
<h4><div class='inline'></div></h4>
|
934
|
+
<pre class="example code"><%= attr.attributes :for => @user do |user| %>
|
935
|
+
<%= user.attribute :name %>
|
936
|
+
<%= user.attribute :email %>
|
937
|
+
<%= user.attribute :profile do %>
|
938
|
+
<%= link_to h(@user.name), user_path(@user) %>
|
939
|
+
<% end %>
|
940
|
+
<% end %></pre>
|
941
|
+
|
942
|
+
<h4><div class='inline'></div></h4>
|
943
|
+
<pre class="example code"><%= attr.attributes :for => :posts do |post| %>
|
944
|
+
<%= post.attribute :author %>
|
945
|
+
<%= post.attribute :title %>
|
946
|
+
<% end %></pre>
|
947
|
+
|
948
|
+
<h4><div class='inline'></div></h4>
|
949
|
+
<pre class="example code"><%= attr.attributes :for => @posts do |post| %>
|
950
|
+
<%= post.attribute :author %>
|
951
|
+
<%= post.attribute :title %>
|
952
|
+
<% end %></pre>
|
960
953
|
|
961
954
|
</div>
|
962
955
|
<h3>Parameters:</h3>
|
@@ -972,10 +965,10 @@ attribute
|
|
972
965
|
|
973
966
|
|
974
967
|
—
|
975
|
-
|
968
|
+
<div class='inline'><p>
|
976
969
|
Options for formating attributes block
|
977
|
-
|
978
|
-
|
970
|
+
</p>
|
971
|
+
</div>
|
979
972
|
|
980
973
|
</li>
|
981
974
|
|
@@ -996,10 +989,10 @@ Options for formating attributes block
|
|
996
989
|
<tt>nil</tt>
|
997
990
|
|
998
991
|
</span>
|
999
|
-
—
|
992
|
+
— <div class='inline'><p>
|
1000
993
|
Optional header of attributes section
|
1001
|
-
|
1002
|
-
|
994
|
+
</p>
|
995
|
+
</div>
|
1003
996
|
</tr>
|
1004
997
|
|
1005
998
|
<li>
|
@@ -1011,10 +1004,10 @@ Optional header of attributes section
|
|
1011
1004
|
<tt>''</tt>
|
1012
1005
|
|
1013
1006
|
</span>
|
1014
|
-
—
|
1007
|
+
— <div class='inline'><p>
|
1015
1008
|
Name of html class to add to attributes block
|
1016
|
-
|
1017
|
-
|
1009
|
+
</p>
|
1010
|
+
</div>
|
1018
1011
|
</tr>
|
1019
1012
|
|
1020
1013
|
<li>
|
@@ -1026,16 +1019,14 @@ Name of html class to add to attributes block
|
|
1026
1019
|
<tt>''</tt>
|
1027
1020
|
|
1028
1021
|
</span>
|
1029
|
-
—
|
1022
|
+
— <div class='inline'><p>
|
1030
1023
|
Name of html class to add to header
|
1031
|
-
|
1032
|
-
|
1024
|
+
</p>
|
1025
|
+
</div>
|
1033
1026
|
</tr>
|
1034
1027
|
|
1035
1028
|
</ul>
|
1036
1029
|
|
1037
|
-
|
1038
|
-
|
1039
1030
|
<h3>Yields:</h3>
|
1040
1031
|
<ul class="yield">
|
1041
1032
|
|
@@ -1047,10 +1038,10 @@ Name of html class to add to header
|
|
1047
1038
|
|
1048
1039
|
|
1049
1040
|
|
1050
|
-
|
1041
|
+
<div class='inline'><p>
|
1051
1042
|
Block which can call #attribute to include attribute value
|
1052
|
-
|
1053
|
-
|
1043
|
+
</p>
|
1044
|
+
</div>
|
1054
1045
|
|
1055
1046
|
</li>
|
1056
1047
|
|
@@ -1061,7 +1052,7 @@ Block which can call #attribute to include attribute value
|
|
1061
1052
|
|
1062
1053
|
|
1063
1054
|
<li class="overload_item">
|
1064
|
-
<span class="signature">- (<tt>Object</tt>) <strong>attributes</strong>(header, options = {}
|
1055
|
+
<span class="signature">- (<tt>Object</tt>) <strong>attributes</strong>(header, options = {}) {|builder| ... }</span>
|
1065
1056
|
<div class="docstring">
|
1066
1057
|
<div class="discussion">
|
1067
1058
|
<p>
|
@@ -1077,41 +1068,41 @@ attribute
|
|
1077
1068
|
<div class="examples">
|
1078
1069
|
<h3>Examples:</h3>
|
1079
1070
|
|
1080
|
-
<h4></h4>
|
1081
|
-
<pre class="example code"
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1086
|
-
<h4></h4>
|
1087
|
-
<pre class="example code"
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
<h4></h4>
|
1096
|
-
<pre class="example code"
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
<h4></h4>
|
1105
|
-
<pre class="example code"
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
<h4></h4>
|
1111
|
-
<pre class="example code"
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1071
|
+
<h4><div class='inline'></div></h4>
|
1072
|
+
<pre class="example code"><%= attr.attributes "User info" do %>
|
1073
|
+
<%= attr.attribute :name" %>
|
1074
|
+
<%= attr.attribute :email %>
|
1075
|
+
<% end %></pre>
|
1076
|
+
|
1077
|
+
<h4><div class='inline'></div></h4>
|
1078
|
+
<pre class="example code"><%= attr.attributes "User", :for => :user do |user| %>
|
1079
|
+
<%= user.attribute :name %>
|
1080
|
+
<%= user.attribute :email %>
|
1081
|
+
<%= user.attribute :profile do %>
|
1082
|
+
<%= link_to h(user.record.name), user_path(user.record) %>
|
1083
|
+
<% end %>
|
1084
|
+
<% end %></pre>
|
1085
|
+
|
1086
|
+
<h4><div class='inline'></div></h4>
|
1087
|
+
<pre class="example code"><% attr.attributes "User", :for => @user do |user| %>
|
1088
|
+
<%= user.attribute :name %>
|
1089
|
+
<%= user.attribute :email %>
|
1090
|
+
<%= user.attribute :profile do %>
|
1091
|
+
<%= link_to h(@user.name), user_path(@user) %>
|
1092
|
+
<% end %>
|
1093
|
+
<% end %></pre>
|
1094
|
+
|
1095
|
+
<h4><div class='inline'></div></h4>
|
1096
|
+
<pre class="example code"><%= attr.attributes "Post", :for => :posts do |post| %>
|
1097
|
+
<%= post.attribute :author %>
|
1098
|
+
<%= post.attribute :title %>
|
1099
|
+
<% end %></pre>
|
1100
|
+
|
1101
|
+
<h4><div class='inline'></div></h4>
|
1102
|
+
<pre class="example code"><%= attr.attributes "Post", :for => @posts do |post| %>
|
1103
|
+
<%= post.attribute :author %>
|
1104
|
+
<%= post.attribute :title %>
|
1105
|
+
<% end %></pre>
|
1115
1106
|
|
1116
1107
|
</div>
|
1117
1108
|
<h3>Parameters:</h3>
|
@@ -1127,10 +1118,10 @@ attribute
|
|
1127
1118
|
|
1128
1119
|
|
1129
1120
|
—
|
1130
|
-
|
1121
|
+
<div class='inline'><p>
|
1131
1122
|
Header of attributes section
|
1132
|
-
|
1133
|
-
|
1123
|
+
</p>
|
1124
|
+
</div>
|
1134
1125
|
|
1135
1126
|
</li>
|
1136
1127
|
|
@@ -1144,10 +1135,10 @@ Header of attributes section
|
|
1144
1135
|
|
1145
1136
|
|
1146
1137
|
—
|
1147
|
-
|
1138
|
+
<div class='inline'><p>
|
1148
1139
|
Options for formating attributes block
|
1149
|
-
|
1150
|
-
|
1140
|
+
</p>
|
1141
|
+
</div>
|
1151
1142
|
|
1152
1143
|
</li>
|
1153
1144
|
|
@@ -1170,10 +1161,10 @@ Options for formating attributes block
|
|
1170
1161
|
<tt>''</tt>
|
1171
1162
|
|
1172
1163
|
</span>
|
1173
|
-
—
|
1164
|
+
— <div class='inline'><p>
|
1174
1165
|
Name of html class to add to attributes block
|
1175
|
-
|
1176
|
-
|
1166
|
+
</p>
|
1167
|
+
</div>
|
1177
1168
|
</tr>
|
1178
1169
|
|
1179
1170
|
<li>
|
@@ -1185,16 +1176,14 @@ Name of html class to add to attributes block
|
|
1185
1176
|
<tt>''</tt>
|
1186
1177
|
|
1187
1178
|
</span>
|
1188
|
-
—
|
1179
|
+
— <div class='inline'><p>
|
1189
1180
|
Name of html class to add to header
|
1190
|
-
|
1191
|
-
|
1181
|
+
</p>
|
1182
|
+
</div>
|
1192
1183
|
</tr>
|
1193
1184
|
|
1194
1185
|
</ul>
|
1195
1186
|
|
1196
|
-
|
1197
|
-
|
1198
1187
|
<h3>Yields:</h3>
|
1199
1188
|
<ul class="yield">
|
1200
1189
|
|
@@ -1206,10 +1195,10 @@ Name of html class to add to header
|
|
1206
1195
|
|
1207
1196
|
|
1208
1197
|
|
1209
|
-
|
1198
|
+
<div class='inline'><p>
|
1210
1199
|
Block which can call #attribute to include attribute value
|
1211
|
-
|
1212
|
-
|
1200
|
+
</p>
|
1201
|
+
</div>
|
1213
1202
|
|
1214
1203
|
</li>
|
1215
1204
|
|
@@ -1219,13 +1208,19 @@ Block which can call #attribute to include attribute value
|
|
1219
1208
|
|
1220
1209
|
<li>
|
1221
1210
|
|
1222
|
-
<span class='type'
|
1211
|
+
<span class='type'></span>
|
1223
1212
|
|
1224
1213
|
|
1225
|
-
<span class='name'>
|
1214
|
+
<span class='name'>builder</span>
|
1226
1215
|
|
1227
1216
|
|
1228
1217
|
|
1218
|
+
—
|
1219
|
+
<div class='inline'><p>
|
1220
|
+
Builder instance holding actual record (retivable via #record)
|
1221
|
+
</p>
|
1222
|
+
</div>
|
1223
|
+
|
1229
1224
|
</li>
|
1230
1225
|
|
1231
1226
|
</ul>
|
@@ -1251,20 +1246,20 @@ symbols (record properties)
|
|
1251
1246
|
<div class="examples">
|
1252
1247
|
<h3>Examples:</h3>
|
1253
1248
|
|
1254
|
-
<h4></h4>
|
1255
|
-
<pre class="example code"
|
1249
|
+
<h4><div class='inline'></div></h4>
|
1250
|
+
<pre class="example code"><%= attr.attributes :name, :email %></pre>
|
1256
1251
|
|
1257
|
-
<h4></h4>
|
1258
|
-
<pre class="example code"
|
1252
|
+
<h4><div class='inline'></div></h4>
|
1253
|
+
<pre class="example code"><%= attr.attributes :name, :email, :for => :author %></pre>
|
1259
1254
|
|
1260
|
-
<h4></h4>
|
1261
|
-
<pre class="example code"
|
1255
|
+
<h4><div class='inline'></div></h4>
|
1256
|
+
<pre class="example code"><%= attr.attributes :name, :email, :for => @user %></pre>
|
1262
1257
|
|
1263
|
-
<h4></h4>
|
1264
|
-
<pre class="example code"
|
1258
|
+
<h4><div class='inline'></div></h4>
|
1259
|
+
<pre class="example code"><%= attr.attributes :title, :for => :posts %></pre>
|
1265
1260
|
|
1266
|
-
<h4></h4>
|
1267
|
-
<pre class="example code"
|
1261
|
+
<h4><div class='inline'></div></h4>
|
1262
|
+
<pre class="example code"><%= attr.attributes :title, :for => @posts %></pre>
|
1268
1263
|
|
1269
1264
|
</div>
|
1270
1265
|
<h3>Parameters:</h3>
|
@@ -1280,10 +1275,10 @@ symbols (record properties)
|
|
1280
1275
|
|
1281
1276
|
|
1282
1277
|
—
|
1283
|
-
|
1278
|
+
<div class='inline'><p>
|
1284
1279
|
List of attributes
|
1285
|
-
|
1286
|
-
|
1280
|
+
</p>
|
1281
|
+
</div>
|
1287
1282
|
|
1288
1283
|
</li>
|
1289
1284
|
|
@@ -1297,10 +1292,10 @@ List of attributes
|
|
1297
1292
|
|
1298
1293
|
|
1299
1294
|
—
|
1300
|
-
|
1295
|
+
<div class='inline'><p>
|
1301
1296
|
Options for formating attributes block
|
1302
|
-
|
1303
|
-
|
1297
|
+
</p>
|
1298
|
+
</div>
|
1304
1299
|
|
1305
1300
|
</li>
|
1306
1301
|
|
@@ -1323,10 +1318,10 @@ Options for formating attributes block
|
|
1323
1318
|
<tt>nil</tt>
|
1324
1319
|
|
1325
1320
|
</span>
|
1326
|
-
—
|
1321
|
+
— <div class='inline'><p>
|
1327
1322
|
Optional header of attributes section
|
1328
|
-
|
1329
|
-
|
1323
|
+
</p>
|
1324
|
+
</div>
|
1330
1325
|
</tr>
|
1331
1326
|
|
1332
1327
|
<li>
|
@@ -1338,10 +1333,10 @@ Optional header of attributes section
|
|
1338
1333
|
<tt>''</tt>
|
1339
1334
|
|
1340
1335
|
</span>
|
1341
|
-
—
|
1336
|
+
— <div class='inline'><p>
|
1342
1337
|
Name of html class to add to attributes block
|
1343
|
-
|
1344
|
-
|
1338
|
+
</p>
|
1339
|
+
</div>
|
1345
1340
|
</tr>
|
1346
1341
|
|
1347
1342
|
<li>
|
@@ -1353,10 +1348,10 @@ Name of html class to add to attributes block
|
|
1353
1348
|
<tt>''</tt>
|
1354
1349
|
|
1355
1350
|
</span>
|
1356
|
-
—
|
1351
|
+
— <div class='inline'><p>
|
1357
1352
|
Name of html class to add to header
|
1358
|
-
|
1359
|
-
|
1353
|
+
</p>
|
1354
|
+
</div>
|
1360
1355
|
</tr>
|
1361
1356
|
|
1362
1357
|
</ul>
|
@@ -1383,20 +1378,20 @@ symbols (record properties)
|
|
1383
1378
|
<div class="examples">
|
1384
1379
|
<h3>Examples:</h3>
|
1385
1380
|
|
1386
|
-
<h4></h4>
|
1387
|
-
<pre class="example code"
|
1381
|
+
<h4><div class='inline'></div></h4>
|
1382
|
+
<pre class="example code"><%= attr.attributes "User info" :name, :email %></pre>
|
1388
1383
|
|
1389
|
-
<h4></h4>
|
1390
|
-
<pre class="example code"
|
1384
|
+
<h4><div class='inline'></div></h4>
|
1385
|
+
<pre class="example code"><%= attr.attributes "Author", :name, :email, :for => :author %></pre>
|
1391
1386
|
|
1392
|
-
<h4></h4>
|
1393
|
-
<pre class="example code"
|
1387
|
+
<h4><div class='inline'></div></h4>
|
1388
|
+
<pre class="example code"><%= attr.attributes "Author", :name, :email, :for => @user %></pre>
|
1394
1389
|
|
1395
|
-
<h4></h4>
|
1396
|
-
<pre class="example code"
|
1390
|
+
<h4><div class='inline'></div></h4>
|
1391
|
+
<pre class="example code"><%= attr.attributes "Post", :title, :for => :posts %></pre>
|
1397
1392
|
|
1398
|
-
<h4></h4>
|
1399
|
-
<pre class="example code"
|
1393
|
+
<h4><div class='inline'></div></h4>
|
1394
|
+
<pre class="example code"><%= attr.attributes "Post", :title, :for => @posts %></pre>
|
1400
1395
|
|
1401
1396
|
</div>
|
1402
1397
|
<h3>Parameters:</h3>
|
@@ -1412,10 +1407,10 @@ symbols (record properties)
|
|
1412
1407
|
|
1413
1408
|
|
1414
1409
|
—
|
1415
|
-
|
1410
|
+
<div class='inline'><p>
|
1416
1411
|
Header of attributes section
|
1417
|
-
|
1418
|
-
|
1412
|
+
</p>
|
1413
|
+
</div>
|
1419
1414
|
|
1420
1415
|
</li>
|
1421
1416
|
|
@@ -1429,10 +1424,10 @@ Header of attributes section
|
|
1429
1424
|
|
1430
1425
|
|
1431
1426
|
—
|
1432
|
-
|
1427
|
+
<div class='inline'><p>
|
1433
1428
|
Optional list of attributes
|
1434
|
-
|
1435
|
-
|
1429
|
+
</p>
|
1430
|
+
</div>
|
1436
1431
|
|
1437
1432
|
</li>
|
1438
1433
|
|
@@ -1446,10 +1441,10 @@ Optional list of attributes
|
|
1446
1441
|
|
1447
1442
|
|
1448
1443
|
—
|
1449
|
-
|
1444
|
+
<div class='inline'><p>
|
1450
1445
|
Options for formating attributes block
|
1451
|
-
|
1452
|
-
|
1446
|
+
</p>
|
1447
|
+
</div>
|
1453
1448
|
|
1454
1449
|
</li>
|
1455
1450
|
|
@@ -1474,10 +1469,10 @@ Options for formating attributes block
|
|
1474
1469
|
<tt>''</tt>
|
1475
1470
|
|
1476
1471
|
</span>
|
1477
|
-
—
|
1472
|
+
— <div class='inline'><p>
|
1478
1473
|
Name of html class to add to attributes block
|
1479
|
-
|
1480
|
-
|
1474
|
+
</p>
|
1475
|
+
</div>
|
1481
1476
|
</tr>
|
1482
1477
|
|
1483
1478
|
<li>
|
@@ -1489,10 +1484,10 @@ Name of html class to add to attributes block
|
|
1489
1484
|
<tt>''</tt>
|
1490
1485
|
|
1491
1486
|
</span>
|
1492
|
-
—
|
1487
|
+
— <div class='inline'><p>
|
1493
1488
|
Name of html class to add to header
|
1494
|
-
|
1495
|
-
|
1489
|
+
</p>
|
1490
|
+
</div>
|
1496
1491
|
</tr>
|
1497
1492
|
|
1498
1493
|
</ul>
|
@@ -1506,7 +1501,7 @@ Name of html class to add to header
|
|
1506
1501
|
<h3>See Also:</h3>
|
1507
1502
|
<ul class="see">
|
1508
1503
|
|
1509
|
-
<li><a href="#attribute-instance_method" title="Attrtastic::SemanticAttributesBuilder#attribute (method)">#attribute</a></li>
|
1504
|
+
<li><span class='object_link'><a href="#attribute-instance_method" title="Attrtastic::SemanticAttributesBuilder#attribute (method)">#attribute</a></span></li>
|
1510
1505
|
|
1511
1506
|
</ul>
|
1512
1507
|
|
@@ -1516,6 +1511,11 @@ Name of html class to add to header
|
|
1516
1511
|
<pre class="lines">
|
1517
1512
|
|
1518
1513
|
|
1514
|
+
174
|
1515
|
+
175
|
1516
|
+
176
|
1517
|
+
177
|
1518
|
+
178
|
1519
1519
|
179
|
1520
1520
|
180
|
1521
1521
|
181
|
@@ -1536,23 +1536,13 @@ Name of html class to add to header
|
|
1536
1536
|
196
|
1537
1537
|
197
|
1538
1538
|
198
|
1539
|
-
199
|
1540
|
-
200
|
1541
|
-
201
|
1542
|
-
202
|
1543
|
-
203
|
1544
|
-
204
|
1545
|
-
205</pre>
|
1539
|
+
199</pre>
|
1546
1540
|
</td>
|
1547
1541
|
<td>
|
1548
|
-
<pre class="code"><span class="info file"># File 'lib/attrtastic.rb', line
|
1542
|
+
<pre class="code"><span class="info file"># File 'lib/attrtastic/semantic_attributes_builder.rb', line 174</span>
|
1549
1543
|
|
1550
1544
|
<span class='kw'>def</span> <span class='id attributes'>attributes</span><span class='lparen'>(</span><span class='op'>*</span><span class='id args'>args</span><span class='comma'>,</span> <span class='op'>&</span><span class='id block'>block</span><span class='rparen'>)</span>
|
1551
|
-
<span class='id options'>options</span> <span class='op'>=</span> <span class='
|
1552
|
-
<span class='kw'>if</span> <span class='id args'>args</span><span class='period'>.</span><span class='id last'>last</span> <span class='kw'>and</span> <span class='id args'>args</span><span class='period'>.</span><span class='id last'>last</span><span class='period'>.</span><span class='id kind_of?'>kind_of?</span> <span class='const'>Hash</span>
|
1553
|
-
<span class='id options'>options</span> <span class='op'>=</span> <span class='id args'>args</span><span class='period'>.</span><span class='id last'>last</span>
|
1554
|
-
<span class='id args'>args</span> <span class='op'>=</span> <span class='id args'>args</span><span class='lbracket'>[</span><span class='int'>0</span> <span class='op'>..</span> <span class='op'>-</span><span class='int'>2</span><span class='rbracket'>]</span>
|
1555
|
-
<span class='kw'>end</span>
|
1545
|
+
<span class='id options'>options</span> <span class='op'>=</span> <span class='id args'>args</span><span class='period'>.</span><span class='id extract_options!'>extract_options!</span>
|
1556
1546
|
<span class='id options'>options</span><span class='lbracket'>[</span><span class='symbol'>:html</span><span class='rbracket'>]</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
1557
1547
|
|
1558
1548
|
<span class='kw'>if</span> <span class='id args'>args</span><span class='period'>.</span><span class='id first'>first</span> <span class='kw'>and</span> <span class='id args'>args</span><span class='period'>.</span><span class='id first'>first</span><span class='period'>.</span><span class='id is_a?'>is_a?</span> <span class='const'>String</span>
|
@@ -1562,15 +1552,18 @@ Name of html class to add to header
|
|
1562
1552
|
<span class='kw'>if</span> <span class='id options'>options</span><span class='lbracket'>[</span><span class='symbol'>:for</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id blank?'>blank?</span>
|
1563
1553
|
<span class='id attributes_for'>attributes_for</span><span class='lparen'>(</span><span class='id record'>record</span><span class='comma'>,</span> <span class='id args'>args</span><span class='comma'>,</span> <span class='id options'>options</span><span class='comma'>,</span> <span class='op'>&</span><span class='id block'>block</span><span class='rparen'>)</span>
|
1564
1554
|
<span class='kw'>else</span>
|
1565
|
-
<span class='kw'>if</span> <span class='id options'>options</span><span class='lbracket'>[</span><span class='symbol'>:for</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id is_a?'>is_a?</span> <span class='const'>Symbol</span>
|
1566
|
-
<span class='id
|
1555
|
+
<span class='id for_value'>for_value</span> <span class='op'>=</span> <span class='kw'>if</span> <span class='id options'>options</span><span class='lbracket'>[</span><span class='symbol'>:for</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id is_a?'>is_a?</span> <span class='const'>Symbol</span>
|
1556
|
+
<span class='id record'>record</span><span class='period'>.</span><span class='id send'>send</span><span class='lparen'>(</span><span class='id options'>options</span><span class='lbracket'>[</span><span class='symbol'>:for</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
1567
1557
|
<span class='kw'>else</span>
|
1568
|
-
<span class='id
|
1558
|
+
<span class='id options'>options</span><span class='lbracket'>[</span><span class='symbol'>:for</span><span class='rbracket'>]</span>
|
1569
1559
|
<span class='kw'>end</span>
|
1570
1560
|
|
1571
|
-
<span class='lbracket'>[</span><span class='op'>*</span><span class='id for_value'>for_value</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id
|
1561
|
+
<span class='lbracket'>[</span><span class='op'>*</span><span class='id for_value'>for_value</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id value'>value</span><span class='op'>|</span>
|
1562
|
+
<span class='id value_options'>value_options</span> <span class='op'>=</span> <span class='id options'>options</span><span class='period'>.</span><span class='id clone'>clone</span>
|
1563
|
+
<span class='id value_options'>value_options</span><span class='lbracket'>[</span><span class='symbol'>:html</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:class</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lbracket'>[</span> <span class='id options'>options</span><span class='lbracket'>[</span><span class='symbol'>:html</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:class</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id value'>value</span><span class='period'>.</span><span class='id class'>class</span><span class='period'>.</span><span class='id to_s'>to_s</span><span class='period'>.</span><span class='id underscore'>underscore</span> <span class='rbracket'>]</span><span class='period'>.</span><span class='id compact'>compact</span><span class='period'>.</span><span class='id join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'> </span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1564
|
+
|
1572
1565
|
<span class='id attributes_for'>attributes_for</span><span class='lparen'>(</span><span class='id value'>value</span><span class='comma'>,</span> <span class='id args'>args</span><span class='comma'>,</span> <span class='id options'>options</span><span class='comma'>,</span> <span class='op'>&</span><span class='id block'>block</span><span class='rparen'>)</span>
|
1573
|
-
<span class='kw'>end</span>
|
1566
|
+
<span class='kw'>end</span><span class='period'>.</span><span class='id join'>join</span>
|
1574
1567
|
<span class='kw'>end</span>
|
1575
1568
|
|
1576
1569
|
<span class='kw'>end</span></pre>
|
@@ -1584,9 +1577,9 @@ Name of html class to add to header
|
|
1584
1577
|
</div>
|
1585
1578
|
|
1586
1579
|
<div id="footer">
|
1587
|
-
Generated on Fri
|
1588
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool">yard</a>
|
1589
|
-
0.
|
1580
|
+
Generated on Fri Dec 3 21:43:44 2010 by
|
1581
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1582
|
+
0.6.3 (ruby-1.9.2).
|
1590
1583
|
</div>
|
1591
1584
|
|
1592
1585
|
</body>
|