jt 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.travis.yml +1 -1
- data/README.md +1 -1
- data/lib/jt.rb +23 -2
- data/lib/jt/version.rb +1 -1
- metadata +28 -4
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46ea65e47ef4066f729f672113b7f1d2e1add42e
|
4
|
+
data.tar.gz: 432b6ffa67a7a872c6bced480c54352b3569572d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16f7d75d7ac6f267b130027c77b7e592d6f72a0a9803e3ab112e0c7e39a15599c97c3aa5c997e7451be2d83a7a4bc2f99379676aa29916927ef9dca85f72b682
|
7
|
+
data.tar.gz: 2c1947e60b3d18ab23d9201d70270e36be6d271011995acc405936203f1eb2ee301f45b385c454af8e28256591dc4c1510387d6036ffc2bc95af6f5e8c09467a
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
ADDED
Binary file
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
data/lib/jt.rb
CHANGED
@@ -7,14 +7,33 @@ class Jt
|
|
7
7
|
T_LINE = '├────'
|
8
8
|
I_LINE = '│'
|
9
9
|
L_LINE = '└────'
|
10
|
+
VALUES = Regexp.union(
|
11
|
+
[
|
12
|
+
"true",
|
13
|
+
"false",
|
14
|
+
"null",
|
15
|
+
/[+-]?\d+\.?\d*/,
|
16
|
+
/".*"/
|
17
|
+
]
|
18
|
+
)
|
10
19
|
|
11
20
|
def self.create(text)
|
12
21
|
new(text)
|
13
22
|
end
|
14
23
|
|
15
24
|
def initialize(text)
|
16
|
-
|
17
|
-
|
25
|
+
object = JSON.parse(text)
|
26
|
+
@queue = []
|
27
|
+
|
28
|
+
if object.instance_of?(Hash)
|
29
|
+
@queue << "root\n".colorize(:red)
|
30
|
+
parse(object)
|
31
|
+
elsif text =~ VALUES
|
32
|
+
@queue << "#{output_value(object)}\n"
|
33
|
+
return
|
34
|
+
else
|
35
|
+
raise "Unexpected value #{object.inspect}"
|
36
|
+
end
|
18
37
|
end
|
19
38
|
|
20
39
|
def to_s
|
@@ -56,6 +75,8 @@ class Jt
|
|
56
75
|
case value.class.to_s
|
57
76
|
when /Hash/
|
58
77
|
value.inspect
|
78
|
+
when /NilClass/
|
79
|
+
"null"
|
59
80
|
when /Integer|Fixnum|Float|Bignum/
|
60
81
|
value.inspect.colorize(:blue)
|
61
82
|
when /TrueClass|FalseClass/
|
data/lib/jt/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,38 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- siman-man
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
|
-
cert_chain:
|
11
|
-
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIID0jCCArqgAwIBAgIBATANBgkqhkiG9w0BAQUFADBoMRAwDgYDVQQDDAdrMTI4
|
14
|
+
NTg1MRIwEAYKCZImiZPyLGQBGRYCaWUxGDAWBgoJkiaJk/IsZAEZFgh1LXJ5dWt5
|
15
|
+
dTESMBAGCgmSJomT8ixkARkWAmFjMRIwEAYKCZImiZPyLGQBGRYCanAwHhcNMTcw
|
16
|
+
NTEyMDg0MzI4WhcNMTgwNTEyMDg0MzI4WjBoMRAwDgYDVQQDDAdrMTI4NTg1MRIw
|
17
|
+
EAYKCZImiZPyLGQBGRYCaWUxGDAWBgoJkiaJk/IsZAEZFgh1LXJ5dWt5dTESMBAG
|
18
|
+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
|
33
|
+
BLzd24MyvHKRaGDWAmiJAd9Z04Vkyw==
|
34
|
+
-----END CERTIFICATE-----
|
35
|
+
date: 2017-10-10 00:00:00.000000000 Z
|
12
36
|
dependencies:
|
13
37
|
- !ruby/object:Gem::Dependency
|
14
38
|
name: colorize
|
@@ -108,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
132
|
version: '0'
|
109
133
|
requirements: []
|
110
134
|
rubyforge_project:
|
111
|
-
rubygems_version: 2.6.
|
135
|
+
rubygems_version: 2.6.13
|
112
136
|
signing_key:
|
113
137
|
specification_version: 4
|
114
138
|
summary: tree command for json
|
metadata.gz.sig
ADDED
Binary file
|