typ-formatter 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/typ/formatter.rb +7 -6
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6522c7f41d30df7d82236ede88fca85320cd95136dfbff7dc8438a6382d6af57
|
4
|
+
data.tar.gz: 558497ea18a4308f1624a7eea1c21cbf5924a6dedf663ac2ce334cf03c75471d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97b8fc7789164463b01624af3a77f90756bcba5cb782fdac57f5971b6514c73e4d7da5c30a42299a520084e2f420c361fca6058d0f24e6e3f3ae089a925e4f6b
|
7
|
+
data.tar.gz: eda281ba1becce128b864f4586a7537668622c5e39094daa59c826fe633f9b31de5f0bdb195d15cde7e75216407759cee6686a25f25dcee3a8d03d02868edff0
|
data/lib/typ/formatter.rb
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
module Typ
|
2
2
|
class Formatter
|
3
|
+
require 'string/indent'
|
3
4
|
require 'rainbow'
|
4
5
|
|
5
6
|
def initialize typ
|
6
|
-
|
7
|
+
k = typ.class
|
7
8
|
@string = if typ.ok?
|
8
|
-
Rainbow(
|
9
|
+
Rainbow(k).green
|
9
10
|
else
|
10
|
-
Rainbow(
|
11
|
+
Rainbow(k).red + "\n" + format_gates_of(typ).indent(2)
|
11
12
|
end
|
12
13
|
end
|
13
14
|
|
@@ -18,15 +19,15 @@ module Typ
|
|
18
19
|
private
|
19
20
|
def format_gates_of typ
|
20
21
|
typ.gates.map do |gate|
|
21
|
-
|
22
|
+
format_gate gate
|
22
23
|
end.join "\n"
|
23
24
|
end
|
24
25
|
|
25
26
|
def format_gate gate
|
26
27
|
case gate
|
27
28
|
when Typ
|
28
|
-
self.class.new
|
29
|
-
when
|
29
|
+
self.class.new gate
|
30
|
+
when Is::Array
|
30
31
|
format_is_array gate
|
31
32
|
end
|
32
33
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: typ-formatter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anatoly Chernow
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rainbow
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: string-indent
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
description:
|
28
42
|
email:
|
29
43
|
executables: []
|