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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 204773240f380151b06b7461e3b23e13ed073eef
4
- data.tar.gz: a54aa43a0e26bd897d07decbc87b3e0f0a1f0092
3
+ metadata.gz: 46ea65e47ef4066f729f672113b7f1d2e1add42e
4
+ data.tar.gz: 432b6ffa67a7a872c6bced480c54352b3569572d
5
5
  SHA512:
6
- metadata.gz: '03981aa27efef4558f08310eb6f498b2e5b189fbebdee80ef512ab8279ea6e12b4eab5fc8f510b790bce4aa6491c6508511cdebc04a5ff51721704a043ba2307'
7
- data.tar.gz: c4c89923ccdb80e0f55f60f11a4b06dc8df39984f84eb7aad446b8edefd8969841f5d36bdb79d0f0650a135bdfc0ad564817d612ebfe76a939f1c2d3c1c2038a
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
@@ -6,4 +6,4 @@ rvm:
6
6
  - 2.2
7
7
  - 2.3.2
8
8
  - 2.4.0
9
- before_install: gem install bundler -v 1.14.3
9
+ before_install: gem install bundler -v 1.15.1
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Jt
1
+ # jt
2
2
 
3
3
  [![Build Status](https://travis-ci.org/siman-man/jt.svg?branch=master)](https://travis-ci.org/siman-man/jt)
4
4
 
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
- @queue = ["root\n".colorize(:red)]
17
- parse(JSON.parse(text))
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
@@ -1,3 +1,3 @@
1
1
  class Jt
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
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.1.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
- date: 2017-03-20 00:00:00.000000000 Z
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIID0jCCArqgAwIBAgIBATANBgkqhkiG9w0BAQUFADBoMRAwDgYDVQQDDAdrMTI4
14
+ NTg1MRIwEAYKCZImiZPyLGQBGRYCaWUxGDAWBgoJkiaJk/IsZAEZFgh1LXJ5dWt5
15
+ dTESMBAGCgmSJomT8ixkARkWAmFjMRIwEAYKCZImiZPyLGQBGRYCanAwHhcNMTcw
16
+ NTEyMDg0MzI4WhcNMTgwNT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Ri8p0CR5Kr8eZGeaIfpMKn4nbQQq4w5wLzNxnecBb26xn4EPHn3dVLF24+NJkf
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.8
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