listify 0.0.2 → 0.0.3
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.
- checksums.yaml +4 -4
- data/lib/listify.rb +28 -0
- data/lib/listify/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 611378efc5e5daac73bb837a84cd67f59ef69a5b
|
4
|
+
data.tar.gz: daba1c279974a1429abc08204d35a4e49f9505ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e02c284089d2d4ebbf69ff5a5bac0f8bde3e5d2846cf099474b6ed0ee8016046a868efe902f3057ed14902567b18e9271f19bc77922fa0977e9b940eb0699596
|
7
|
+
data.tar.gz: 6aca238fa49a097dfc814b0ba4b49373b3a4129c2b782d507ddac95976e00aba429c8650f55bfca94c20f31edea8ee58161e5e501e916936e02fbb101fc0ff8b
|
data/lib/listify.rb
CHANGED
@@ -2,6 +2,34 @@ module Listify
|
|
2
2
|
|
3
3
|
module Helper
|
4
4
|
|
5
|
+
# Generate an HTML list from a ruby collection
|
6
|
+
# @param [Array, Hash{sublist_name => sublist[Array, Hash]}] collection the collection to render as a list
|
7
|
+
# @return ActiveSupport::SafeBuffer
|
8
|
+
#
|
9
|
+
# @example Simple List
|
10
|
+
# listify( ['first item', 'second item', 'third item'] )
|
11
|
+
# => "<ul>
|
12
|
+
# <li>first item</li>
|
13
|
+
# <li>second item</li>
|
14
|
+
# <li>third item</li>
|
15
|
+
# </ul>"
|
16
|
+
#
|
17
|
+
# @example Nested List
|
18
|
+
# listify( {'First Category' => ['item one', 'item two'], 'Second Category' => ['item three', 'item four'] } )
|
19
|
+
# => "<ul>
|
20
|
+
# <li>First Category
|
21
|
+
# <ul>
|
22
|
+
# <li>item one</li>
|
23
|
+
# <li>item two</li>
|
24
|
+
# </ul>
|
25
|
+
# </li>
|
26
|
+
# <li>Second Category
|
27
|
+
# <ul>
|
28
|
+
# <li>item three</li>
|
29
|
+
# <li>item four</li>
|
30
|
+
# </ul>
|
31
|
+
# </li>
|
32
|
+
# </ul>"
|
5
33
|
def listify(collection)
|
6
34
|
content_tag :ul do
|
7
35
|
concat list_items_for(collection)
|
data/lib/listify/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: listify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 'Byron Appelt '
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-08-
|
11
|
+
date: 2013-08-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|