json2table 1.0.6 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/json2table.rb +24 -17
- 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: 3b34233af7e741c0880e8d62c447dc918924b8cb
|
4
|
+
data.tar.gz: b6f9eed5b0ec61c9c78f79019c2be731a3ee5a07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d53232aab60e01d429e094c897c29daae3bd24e29ffc44948c5f486f4c03545e17acbc0cb16d0524bb329377d7bcee6bc58d2041d6b01cc23f9f104dfbf332d
|
7
|
+
data.tar.gz: faf821ca12b96c3f9310fde7c6838720a02720918b0cec93a54f851228599bc1efa2976d6b640b50fc2ba74254492f4fdf11d10733cba756ba8b9c2fb8ea92a9
|
data/lib/json2table.rb
CHANGED
@@ -71,8 +71,10 @@ module Json2table
|
|
71
71
|
end
|
72
72
|
else
|
73
73
|
# array of a primitive data types eg. [1,2,3]
|
74
|
-
# all values can be displayed in
|
75
|
-
|
74
|
+
# all values can be displayed in a single column table
|
75
|
+
arr.each do |element|
|
76
|
+
html += "#{element}<br/>\n"
|
77
|
+
end
|
76
78
|
end
|
77
79
|
return html
|
78
80
|
end
|
@@ -118,21 +120,26 @@ module Json2table
|
|
118
120
|
if hash[key].is_a?(Hash) # another hash, create table out of it
|
119
121
|
html += "<td>#{create_table(hash[key], options)}</td>\n"
|
120
122
|
elsif hash[key].is_a?(Array)
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
123
|
+
html += "<td>\n"
|
124
|
+
html += process_array(hash[key], options)
|
125
|
+
html += "</td>\n"
|
126
|
+
# if hash[key][0].is_a?(Hash) # Array of hashes
|
127
|
+
# k = similar_keys?(hash[key])
|
128
|
+
# if k
|
129
|
+
# # if elements of this array are hashes with same keys,
|
130
|
+
# # display it as a top-down table
|
131
|
+
# html += "<td>\n"
|
132
|
+
# html += create_vertical_table_from_array(hash[key], k, options)
|
133
|
+
# html += "</td>\n"
|
134
|
+
# else
|
135
|
+
# # non similar keys, create horizontal table
|
136
|
+
# hash[key].each do |h|
|
137
|
+
# html += create_table(h, options)
|
138
|
+
# end
|
139
|
+
# end
|
140
|
+
# else
|
141
|
+
# html += "<td>#{hash[key]}</td>\n"
|
142
|
+
# end
|
136
143
|
else
|
137
144
|
html += "<td>#{hash[key]}</td>\n"
|
138
145
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json2table
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code Express
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |-
|
14
14
|
This gem provides functionality to convert a JSON object into HTML
|