typ-formatter 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/typ/formatter.rb +12 -0
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6522c7f41d30df7d82236ede88fca85320cd95136dfbff7dc8438a6382d6af57
4
- data.tar.gz: 558497ea18a4308f1624a7eea1c21cbf5924a6dedf663ac2ce334cf03c75471d
3
+ metadata.gz: 5e4e33337a51f5d9c3e197e29cfcf3e5e51bbcbb341c923e5c0efc6a711e240c
4
+ data.tar.gz: 22be26a0cfdc410f9b828f26ce691376e6bdba52e3b5fa148013332435fd0fd2
5
5
  SHA512:
6
- metadata.gz: 97b8fc7789164463b01624af3a77f90756bcba5cb782fdac57f5971b6514c73e4d7da5c30a42299a520084e2f420c361fca6058d0f24e6e3f3ae089a925e4f6b
7
- data.tar.gz: eda281ba1becce128b864f4586a7537668622c5e39094daa59c826fe633f9b31de5f0bdb195d15cde7e75216407759cee6686a25f25dcee3a8d03d02868edff0
6
+ metadata.gz: 07062bb2dcd94f09916a69fa05eaa30bcc3e97114d8d956c10a8291b02d95ca9e2631be0fe1b1b0aff633933158c3316e489806bd9c45a18cae87408b1a29e18
7
+ data.tar.gz: 42caa83d32d8a78692995ec255a2fd42ab55984e759e1d66f3aad29e0e548b69b920239c3e10e3b3f723a7f50afdcb041993881ae99a0a189ab18100aa9a3be9
data/lib/typ/formatter.rb CHANGED
@@ -29,6 +29,8 @@ module Typ
29
29
  self.class.new gate
30
30
  when Is::Array
31
31
  format_is_array gate
32
+ when IsA
33
+ format_is_a gate
32
34
  end
33
35
  end
34
36
 
@@ -36,5 +38,15 @@ module Typ
36
38
  string = "is #{gate.to_a}"
37
39
  gate.ok? ? Rainbow(string).green : Rainbow(string).red
38
40
  end
41
+
42
+ def format_is_a gate
43
+ is_a = "is_a #{gate.class.type}"
44
+
45
+ if gate.ok?
46
+ Rainbow(is_a).green
47
+ else
48
+ Rainbow(is_a).red + "\n" + "got #{gate.it.class}".indent(2)
49
+ end
50
+ end
39
51
  end
40
52
  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.1
4
+ version: 0.0.2
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-28 00:00:00.000000000 Z
11
+ date: 2018-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rainbow