kind_dom 0.9.1 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README +8 -1
- data/lib/kind_dom.rb +9 -2
- metadata +1 -1
data/README
CHANGED
@@ -11,8 +11,15 @@ As a contrived example, in the controller:
|
|
11
11
|
|
12
12
|
In the view:
|
13
13
|
<% @results.first_of('//item') do |item| -%>
|
14
|
+
<!-- this block is only executed if `item` is found -->
|
15
|
+
|
16
|
+
<% item.content_for('title') do |title| -%>
|
17
|
+
<!-- this block is only executed if `title` has content -->
|
18
|
+
<p><%=h title %></p>
|
19
|
+
<% end -%>
|
20
|
+
|
14
21
|
<% item.content_for('description') do |description| -%>
|
15
|
-
<!-- this block is only executed if `
|
22
|
+
<!-- this block is only executed if `description` has content -->
|
16
23
|
<p><%=h description %></p>
|
17
24
|
<% end -%>
|
18
25
|
<% end -%>
|
data/lib/kind_dom.rb
CHANGED
@@ -13,11 +13,18 @@ require 'xml/libxml'
|
|
13
13
|
#
|
14
14
|
# As a contrived example, in the controller:
|
15
15
|
# @results = KindDom.new(xml_data)
|
16
|
-
#
|
16
|
+
#
|
17
17
|
# In the view:
|
18
18
|
# <% @results.first_of('//item') do |item| -%>
|
19
|
+
# <!-- this block is only executed if `item` is found -->
|
20
|
+
#
|
21
|
+
# <% item.content_for('title') do |title| -%>
|
22
|
+
# <!-- this block is only executed if `title` has content -->
|
23
|
+
# <p><%=h title %></p>
|
24
|
+
# <% end -%>
|
25
|
+
#
|
19
26
|
# <% item.content_for('description') do |description| -%>
|
20
|
-
# <!-- this block is only executed if `
|
27
|
+
# <!-- this block is only executed if `description` has content -->
|
21
28
|
# <p><%=h description %></p>
|
22
29
|
# <% end -%>
|
23
30
|
# <% end -%>
|