attrtastic 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- attrtastic (0.4.1)
4
+ attrtastic (0.4.2)
5
5
  actionpack (>= 3.0)
6
6
  activesupport (>= 3.0)
7
7
 
@@ -99,7 +99,7 @@
99
99
  <dt id="VERSION-constant" class="">VERSION =
100
100
 
101
101
  </dt>
102
- <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>0.4.0</span><span class='tstring_end'>&quot;</span></span></pre></dd>
102
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>0.4.2</span><span class='tstring_end'>&quot;</span></span></pre></dd>
103
103
 
104
104
  </dl>
105
105
 
@@ -113,7 +113,7 @@
113
113
  </div>
114
114
 
115
115
  <div id="footer">
116
- Generated on Sat Jun 25 13:32:39 2011 by
116
+ Generated on Tue Aug 16 11:49:20 2011 by
117
117
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
118
118
  0.7.2 (ruby-1.9.2).
119
119
  </div>
@@ -107,7 +107,7 @@
107
107
  </div>
108
108
 
109
109
  <div id="footer">
110
- Generated on Sat Jun 25 13:32:39 2011 by
110
+ Generated on Tue Aug 16 11:49:20 2011 by
111
111
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
112
112
  0.7.2 (ruby-1.9.2).
113
113
  </div>
@@ -1685,7 +1685,7 @@ Name of html class to add to header
1685
1685
  </div>
1686
1686
 
1687
1687
  <div id="footer">
1688
- Generated on Sat Jun 25 13:32:39 2011 by
1688
+ Generated on Tue Aug 16 11:49:21 2011 by
1689
1689
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1690
1690
  0.7.2 (ruby-1.9.2).
1691
1691
  </div>
@@ -193,6 +193,9 @@ attributes @param[Hash] options Opions
193
193
  &lt;% end %&gt;
194
194
  &lt;% end %&gt;</pre>
195
195
 
196
+ <h4><div class='inline'></div></h4>
197
+ <pre class="example code">&lt;%= semantic_attributes_for @user %&gt;</pre>
198
+
196
199
  </div>
197
200
  <h3>Parameters:</h3>
198
201
  <ul class="param">
@@ -290,9 +293,6 @@ Builder for attributes for given AR record
290
293
  <pre class="lines">
291
294
 
292
295
 
293
- 41
294
- 42
295
- 43
296
296
  44
297
297
  45
298
298
  46
@@ -300,10 +300,17 @@ Builder for attributes for given AR record
300
300
  48
301
301
  49
302
302
  50
303
- 51</pre>
303
+ 51
304
+ 52
305
+ 53
306
+ 54
307
+ 55
308
+ 56
309
+ 57
310
+ 58</pre>
304
311
  </td>
305
312
  <td>
306
- <pre class="code"><span class="info file"># File 'lib/attrtastic/semantic_attributes_helper.rb', line 41</span>
313
+ <pre class="code"><span class="info file"># File 'lib/attrtastic/semantic_attributes_helper.rb', line 44</span>
307
314
 
308
315
  <span class='kw'>def</span> <span class='id semantic_attributes_for'>semantic_attributes_for</span><span class='lparen'>(</span><span class='id record'>record</span><span class='comma'>,</span> <span class='id options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id block'>block</span><span class='rparen'>)</span>
309
316
  <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>
@@ -313,6 +320,10 @@ Builder for attributes for given AR record
313
320
  <span class='id output'>output</span> <span class='op'>=</span> <span class='id tag'>tag</span><span class='lparen'>(</span><span class='symbol'>:div</span><span class='comma'>,</span> <span class='lbrace'>{</span> <span class='symbol'>:class</span> <span class='op'>=&gt;</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>
314
321
  <span class='kw'>if</span> <span class='id block_given?'>block_given?</span>
315
322
  <span class='id output'>output</span> <span class='op'>&lt;&lt;</span> <span class='id capture'>capture</span><span class='lparen'>(</span><span class='const'>SemanticAttributesBuilder</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='id record'>record</span><span class='comma'>,</span> <span class='kw'>self</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id block'>block</span><span class='rparen'>)</span>
323
+ <span class='kw'>else</span>
324
+ <span class='id output'>output</span> <span class='op'>&lt;&lt;</span> <span class='id capture'>capture</span><span class='lparen'>(</span><span class='const'>SemanticAttributesBuilder</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='id record'>record</span><span class='comma'>,</span> <span class='kw'>self</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id attr'>attr</span><span class='op'>|</span>
325
+ <span class='id attr'>attr</span><span class='period'>.</span><span class='id attributes'>attributes</span>
326
+ <span class='kw'>end</span>
316
327
  <span class='kw'>end</span>
317
328
  <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'>&quot;</span><span class='tstring_content'>&lt;/div&gt;</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
318
329
  <span class='kw'>end</span></pre>
@@ -326,7 +337,7 @@ Builder for attributes for given AR record
326
337
  </div>
327
338
 
328
339
  <div id="footer">
329
- Generated on Sat Jun 25 13:32:39 2011 by
340
+ Generated on Tue Aug 16 11:49:20 2011 by
330
341
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
331
342
  0.7.2 (ruby-1.9.2).
332
343
  </div>
@@ -134,7 +134,7 @@
134
134
  </div>
135
135
 
136
136
  <div id="footer">
137
- Generated on Sat Jun 25 13:32:39 2011 by
137
+ Generated on Tue Aug 16 11:49:20 2011 by
138
138
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
139
139
  0.7.2 (ruby-1.9.2).
140
140
  </div>
@@ -114,7 +114,7 @@ future version unintentionally.</li>
114
114
  <p>Copyright (c) 2009-2011 Boruta Mirosław. See LICENSE for details.</p></div></div>
115
115
 
116
116
  <div id="footer">
117
- Generated on Sat Jun 25 13:32:39 2011 by
117
+ Generated on Tue Aug 16 11:49:20 2011 by
118
118
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
119
119
  0.7.2 (ruby-1.9.2).
120
120
  </div>
@@ -114,7 +114,7 @@ future version unintentionally.</li>
114
114
  <p>Copyright (c) 2009-2011 Boruta Mirosław. See LICENSE for details.</p></div></div>
115
115
 
116
116
  <div id="footer">
117
- Generated on Sat Jun 25 13:32:39 2011 by
117
+ Generated on Tue Aug 16 11:49:20 2011 by
118
118
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
119
119
  0.7.2 (ruby-1.9.2).
120
120
  </div>
@@ -94,7 +94,7 @@
94
94
  </div>
95
95
 
96
96
  <div id="footer">
97
- Generated on Sat Jun 25 13:32:39 2011 by
97
+ Generated on Tue Aug 16 11:49:21 2011 by
98
98
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
99
99
  0.7.2 (ruby-1.9.2).
100
100
  </div>
@@ -38,6 +38,9 @@ module Attrtastic
38
38
  # <% end %>
39
39
  # <% end %>
40
40
  #
41
+ # @example
42
+ # <%= semantic_attributes_for @user %>
43
+ #
41
44
  def semantic_attributes_for(record, options = {}, &block)
42
45
  options[:html] ||= {}
43
46
 
@@ -46,6 +49,10 @@ module Attrtastic
46
49
  output = tag(:div, { :class => html_class}, true)
47
50
  if block_given?
48
51
  output << capture(SemanticAttributesBuilder.new(record, self), &block)
52
+ else
53
+ output << capture(SemanticAttributesBuilder.new(record, self)) do |attr|
54
+ attr.attributes
55
+ end
49
56
  end
50
57
  output.safe_concat("</div>")
51
58
  end
@@ -1,3 +1,3 @@
1
1
  module Attrtastic
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
@@ -9,18 +9,24 @@ class TestSemanticAttributesHelper < TestCase
9
9
  end
10
10
 
11
11
  should "generate output event when no block given" do
12
- expected = html <<-EOHTML
13
- <div class="attrtastic user">
14
- </div>
15
- EOHTML
16
- actual = @template.semantic_attributes_for(@user)
17
-
18
- assert_equal expected, actual
19
-
20
- #@template.output_buffer.clear
21
-
22
12
  expected = html <<-EOHTML
23
13
  <div class="attrtastic blog">
14
+ <div class="attributes">
15
+ <ol>
16
+ <li class="attribute">
17
+ <span class="label">Name</span>
18
+ <span class="value">IT Pro Blog</span>
19
+ </li>
20
+ <li class="attribute">
21
+ <span class="label">Url</span>
22
+ <span class="value">http://www.it.pro.blog</span>
23
+ </li>
24
+ <li class="attribute">
25
+ <span class="label">Author full name</span>
26
+ <span class="value">Doe, John</span>
27
+ </li>
28
+ </ol>
29
+ </div>
24
30
  </div>
25
31
  EOHTML
26
32
  actual = @template.semantic_attributes_for(@blog)
@@ -42,7 +48,9 @@ class TestSemanticAttributesHelper < TestCase
42
48
  <div class="attrtastic user simple show">
43
49
  </div>
44
50
  EOHTML
45
- actual = @template.semantic_attributes_for(@user, :html => {:class => 'simple show'})
51
+ actual = @template.semantic_attributes_for(@user, :html => {:class => 'simple show'}) do |attr|
52
+ true
53
+ end
46
54
 
47
55
  assert_equal expected, actual
48
56
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: attrtastic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: yard
17
- requirement: &8555040 !ruby/object:Gem::Requirement
17
+ requirement: &8213840 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 0.6.0
23
23
  type: :development
24
24
  prerelease: false
25
- version_requirements: *8555040
25
+ version_requirements: *8213840
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: bluecloth
28
- requirement: &8554520 !ruby/object:Gem::Requirement
28
+ requirement: &8213320 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ~>
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 2.0.0
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *8554520
36
+ version_requirements: *8213320
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: shoulda
39
- requirement: &8554040 !ruby/object:Gem::Requirement
39
+ requirement: &8212840 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ~>
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: 2.11.0
45
45
  type: :development
46
46
  prerelease: false
47
- version_requirements: *8554040
47
+ version_requirements: *8212840
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: activesupport
50
- requirement: &8553560 !ruby/object:Gem::Requirement
50
+ requirement: &8212360 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: '3.0'
56
56
  type: :runtime
57
57
  prerelease: false
58
- version_requirements: *8553560
58
+ version_requirements: *8212360
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: actionpack
61
- requirement: &8553080 !ruby/object:Gem::Requirement
61
+ requirement: &8211880 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ! '>='
@@ -66,7 +66,7 @@ dependencies:
66
66
  version: '3.0'
67
67
  type: :runtime
68
68
  prerelease: false
69
- version_requirements: *8553080
69
+ version_requirements: *8211880
70
70
  description: Rails view helper for scaffolding show/index pages for objects
71
71
  email:
72
72
  - boruta.miroslaw@gmail.com