jsonpp 1.1.0.rc2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/jsonpp +27 -7
- metadata +20 -45
data/bin/jsonpp
CHANGED
@@ -105,14 +105,13 @@ class JSONPP < PrettyPrint
|
|
105
105
|
end
|
106
106
|
|
107
107
|
def objenc(obj)
|
108
|
-
|
109
|
-
seplist(obj
|
108
|
+
bgroup(2, red('{'), red('}'), 1, 1) do
|
109
|
+
seplist(obj.keys.sort) do |k|
|
110
110
|
group do
|
111
111
|
pp k
|
112
|
-
text ':'
|
113
|
-
group
|
114
|
-
|
115
|
-
pp v
|
112
|
+
text ': '
|
113
|
+
group do
|
114
|
+
pp obj[k]
|
116
115
|
end
|
117
116
|
end
|
118
117
|
end
|
@@ -120,13 +119,34 @@ class JSONPP < PrettyPrint
|
|
120
119
|
end
|
121
120
|
|
122
121
|
def arrenc(arr)
|
123
|
-
|
122
|
+
bgroup(2, green('['), green(']'), 1, 1) do
|
124
123
|
seplist(arr) do |v|
|
125
124
|
pp v
|
126
125
|
end
|
127
126
|
end
|
128
127
|
end
|
129
128
|
|
129
|
+
def text(obj, width=nil)
|
130
|
+
if width.nil?
|
131
|
+
# Remove the ANSI codes
|
132
|
+
nocolor = obj.gsub(/\033\[[0-9;]*m/,'')
|
133
|
+
width = nocolor.length
|
134
|
+
end
|
135
|
+
super(obj, width)
|
136
|
+
end
|
137
|
+
|
138
|
+
def bgroup(indent=0, open_obj='', close_obj='', open_width=open_obj.length, close_width=close_obj.length)
|
139
|
+
text open_obj, open_width
|
140
|
+
group_sub {
|
141
|
+
nest(indent) {
|
142
|
+
breakable ''
|
143
|
+
yield
|
144
|
+
}
|
145
|
+
}
|
146
|
+
breakable ''
|
147
|
+
text close_obj, close_width
|
148
|
+
end
|
149
|
+
|
130
150
|
def comma_breakable
|
131
151
|
text blue(',')
|
132
152
|
breakable
|
metadata
CHANGED
@@ -1,73 +1,48 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsonpp
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 1
|
9
|
-
- 0
|
10
|
-
- rc
|
11
|
-
- 2
|
12
|
-
version: 1.1.0.rc2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.0
|
5
|
+
prerelease:
|
13
6
|
platform: ruby
|
14
|
-
authors:
|
7
|
+
authors:
|
15
8
|
- Jonas Pfenniger
|
16
9
|
autorequire:
|
17
10
|
bindir: bin
|
18
11
|
cert_chain: []
|
19
|
-
|
20
|
-
date: 2013-03-13 00:00:00 +00:00
|
21
|
-
default_executable:
|
12
|
+
date: 2013-03-23 00:00:00.000000000 Z
|
22
13
|
dependencies: []
|
23
|
-
|
24
14
|
description: A really small gem that prints your `curl` output nicely
|
25
15
|
email: jonas@pfenniger.name
|
26
|
-
executables:
|
16
|
+
executables:
|
27
17
|
- jsonpp
|
28
18
|
extensions: []
|
29
|
-
|
30
19
|
extra_rdoc_files: []
|
31
|
-
|
32
|
-
files:
|
20
|
+
files:
|
33
21
|
- README.md
|
34
22
|
- bin/jsonpp
|
35
23
|
- okjson.rb
|
36
|
-
has_rdoc: true
|
37
24
|
homepage: https://github.com/zimbatm/jsonpp
|
38
25
|
licenses: []
|
39
|
-
|
40
26
|
post_install_message:
|
41
27
|
rdoc_options: []
|
42
|
-
|
43
|
-
require_paths:
|
28
|
+
require_paths:
|
44
29
|
- lib
|
45
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
30
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
46
31
|
none: false
|
47
|
-
requirements:
|
48
|
-
- -
|
49
|
-
- !ruby/object:Gem::Version
|
50
|
-
|
51
|
-
|
52
|
-
- 0
|
53
|
-
version: "0"
|
54
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - ! '>='
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '0'
|
36
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
37
|
none: false
|
56
|
-
requirements:
|
57
|
-
- -
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
|
60
|
-
segments:
|
61
|
-
- 1
|
62
|
-
- 3
|
63
|
-
- 1
|
64
|
-
version: 1.3.1
|
38
|
+
requirements:
|
39
|
+
- - ! '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
65
42
|
requirements: []
|
66
|
-
|
67
43
|
rubyforge_project:
|
68
|
-
rubygems_version: 1.
|
44
|
+
rubygems_version: 1.8.23
|
69
45
|
signing_key:
|
70
46
|
specification_version: 3
|
71
47
|
summary: Command-line JSON pretty-printer
|
72
48
|
test_files: []
|
73
|
-
|