data-converter 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -2
- data/data-converter.gemspec +4 -4
- data/lib/data-converter.rb +7 -8
- metadata +6 -6
data/README.rdoc
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
gem install data-converter
|
6
6
|
|
7
7
|
==Description
|
8
|
-
|
8
|
+
Convert hash and array into HTML Element (Array => ul, Hash => dl).
|
9
9
|
It's under the development.
|
10
10
|
|
11
11
|
==Code
|
@@ -21,4 +21,4 @@
|
|
21
21
|
the MIT License
|
22
22
|
|
23
23
|
==Author
|
24
|
-
namusyaka
|
24
|
+
namusyaka
|
data/data-converter.gemspec
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
Gem::Specification.new do | spec |
|
2
2
|
spec.name = "data-converter"
|
3
|
-
spec.version = "0.1.
|
4
|
-
spec.summary = "
|
5
|
-
spec.description = "
|
3
|
+
spec.version = "0.1.6"
|
4
|
+
spec.summary = "It is under the devlopment."
|
5
|
+
spec.description = "Convert hash and array into HTML Element (Array => ul, Hash => dl)."
|
6
6
|
spec.homepage = "https://github.com/namusyaka/data-converter"
|
7
7
|
spec.author = "namusyaka"
|
8
8
|
spec.email = "namusyaka@gmail.com"
|
@@ -14,4 +14,4 @@ test
|
|
14
14
|
lib/data-converter.rb
|
15
15
|
test/test.rb
|
16
16
|
)
|
17
|
-
end
|
17
|
+
end
|
data/lib/data-converter.rb
CHANGED
@@ -7,27 +7,26 @@ end
|
|
7
7
|
class DataConverter
|
8
8
|
attr_reader :data
|
9
9
|
|
10
|
-
ARRAY = "Array"
|
11
|
-
HASH = "Hash"
|
12
|
-
|
13
10
|
def initialize(data)
|
14
11
|
@data = data
|
15
12
|
end
|
16
13
|
|
17
14
|
def self.parse(data)
|
18
15
|
constructor = self.new(data)
|
19
|
-
constructor.convert
|
16
|
+
constructor.convert
|
20
17
|
end
|
21
18
|
|
22
|
-
def convert(data =
|
23
|
-
|
24
|
-
|
19
|
+
def convert(data = nil)
|
20
|
+
data = @data unless data
|
21
|
+
|
22
|
+
case data
|
23
|
+
when Array
|
25
24
|
list = <<-UL
|
26
25
|
<ul>
|
27
26
|
#{ convert_to_li(data).join("\n") }
|
28
27
|
</ul>
|
29
28
|
UL
|
30
|
-
when
|
29
|
+
when Hash
|
31
30
|
list = <<-DL
|
32
31
|
<dl>
|
33
32
|
#{ convert_to_dl_childs(data) }</dl>
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: data-converter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 6
|
10
|
+
version: 0.1.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- namusyaka
|
@@ -15,10 +15,10 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2012-09-29 00:00:00 Z
|
19
19
|
dependencies: []
|
20
20
|
|
21
|
-
description:
|
21
|
+
description: Convert hash and array into HTML Element (Array => ul, Hash => dl).
|
22
22
|
email: namusyaka@gmail.com
|
23
23
|
executables: []
|
24
24
|
|
@@ -63,6 +63,6 @@ rubyforge_project:
|
|
63
63
|
rubygems_version: 1.8.1
|
64
64
|
signing_key:
|
65
65
|
specification_version: 3
|
66
|
-
summary:
|
66
|
+
summary: It is under the devlopment.
|
67
67
|
test_files: []
|
68
68
|
|