neatjson 0.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/neatjson.rb +11 -3
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64c5854c172eb390bfde86510249681edec98bb8
|
4
|
+
data.tar.gz: 9fb24cd03782f06920f6dece4a387162621bc289
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b7126888caaeaf5396ff4ba003865ef2d32f8d2b716907ac77a828c3c216e9dc9ab157d1a0689b9c22229e3a76c53d5a7b8be8da3eb2763585d1243e2ea904a
|
7
|
+
data.tar.gz: e043570423bc55294a2176872fe68bfbb8fddee7f1ad0a001c053ee00345434f9be51ba5e97c579836c9f11678413a7fef0b89e469c6890aebf12656db47ab10
|
data/lib/neatjson.rb
CHANGED
@@ -83,9 +83,17 @@ module JSON
|
|
83
83
|
longest = keyvals.map(&:first).map(&:length).max
|
84
84
|
keyvals.each{ |k,v| k.replace( "%-#{longest}s" % k ) }
|
85
85
|
end
|
86
|
-
|
87
|
-
|
88
|
-
|
86
|
+
keyvals.map! do |k,v|
|
87
|
+
indent2 = " "*"#{k}#{colon}".length
|
88
|
+
one_line = "#{k}#{colon}#{build[v,'']}"
|
89
|
+
if opts[:wrap] && (one_line.length > opts[:wrap]) && (v.is_a?(Array) || v.is_a?(Hash))
|
90
|
+
"#{k}#{colon}#{build[v,indent2].lstrip}"
|
91
|
+
else
|
92
|
+
one_line
|
93
|
+
end
|
94
|
+
end
|
95
|
+
keyvals.last << opad << "}"
|
96
|
+
keyvals.join ",\n"
|
89
97
|
else
|
90
98
|
keyvals = o.map{ |k,v| ["#{indent}#{opts[:indent]}#{k.to_s.inspect}",v] }
|
91
99
|
keyvals = keyvals.sort_by(&:first) if opts[:sorted]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: neatjson
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.2'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gavin Kistner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: gavin@phrogz.net
|
@@ -36,8 +36,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
36
36
|
version: '0'
|
37
37
|
requirements: []
|
38
38
|
rubyforge_project:
|
39
|
-
rubygems_version: 2.
|
39
|
+
rubygems_version: 2.4.5
|
40
40
|
signing_key:
|
41
41
|
specification_version: 4
|
42
42
|
summary: Pretty, powerful JSON generation.
|
43
43
|
test_files: []
|
44
|
+
has_rdoc: yard
|