json2table 1.0.6 → 1.0.7

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/json2table.rb +24 -17
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 83ae1473b10e024c00c97bdf78550d78c9594df6
4
- data.tar.gz: 6b9da577a2650199c5a86226eb704b68abf093c6
3
+ metadata.gz: 3b34233af7e741c0880e8d62c447dc918924b8cb
4
+ data.tar.gz: b6f9eed5b0ec61c9c78f79019c2be731a3ee5a07
5
5
  SHA512:
6
- metadata.gz: 1d4b1a6079d35f5c427748667ff814d58e864f6d3a96facc2426b81e8f502b081ec39d0384c59256d07c5f4a3ce141840262e7b3516d2341091769b6d35fb21c
7
- data.tar.gz: c8c2262d59e9345f97ffcb435e802696e661ea08c8874355a25fecb79409a3a9384e2c539ceb851ce56a9ad59b88d9811ccefede7c8afe5b982bb09f68403a97
6
+ metadata.gz: 8d53232aab60e01d429e094c897c29daae3bd24e29ffc44948c5f486f4c03545e17acbc0cb16d0524bb329377d7bcee6bc58d2041d6b01cc23f9f104dfbf332d
7
+ data.tar.gz: faf821ca12b96c3f9310fde7c6838720a02720918b0cec93a54f851228599bc1efa2976d6b640b50fc2ba74254492f4fdf11d10733cba756ba8b9c2fb8ea92a9
@@ -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 in cell
75
- html += "#{arr}</td></tr>\n"
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
- if hash[key][0].is_a?(Hash) # Array of hashes
122
- k = similar_keys?(hash[key])
123
- if k
124
- # if elements of this array are hashes with same keys,
125
- # display it as a top-down table
126
- html += "<td>\n"
127
- html += create_vertical_table_from_array(hash[key], k, options)
128
- html += "</td>\n"
129
- else
130
- # non similar keys, create horizontal table
131
- hash[key].each do |h|
132
- html += create_table(h, options)
133
- end
134
- end
135
- end
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.6
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-14 00:00:00.000000000 Z
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