typ-formatter 0.1.2 → 0.1.3

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 +8 -9
  3. metadata +8 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 13b522d7882ac57e1b82d09342f3bf0a8422a61b274d74fd29737fbcf60d0a82
4
- data.tar.gz: 7047a7cc861058201e488d232d3ec07ef397ab9f4b968d5e090ee61d66b4628b
3
+ metadata.gz: b9d82405d57caa07af16d5bf55e066065a87642261e81aabcca3b8280112ac33
4
+ data.tar.gz: ebd6407d511550f6e35867c26a2e05decb0ce64404eef52cca2dab2e37210110
5
5
  SHA512:
6
- metadata.gz: fb7ea2ae8dc7c4c1de4c0481a0a740a3c982c31820617f7820abfc658271e0a882e9feae2f3caef6039cd9e9cfa8944fda4e7cc3dc9cfbb710b9536ae6301a58
7
- data.tar.gz: a626757747049127ff9f2cb4dcc4e333dcf1b47681ab2bccd9d7f10fa11843a923619d56f11936c5595f10bc9a437961f6ef9df397750e235e44f00cf6973c0c
6
+ metadata.gz: 2399565055464b9b55a4a64918eea1f42e1d73778ada7e07d4be2ea3fecfc7ffd1629f5f54bdd8b5f7238cefe4c43ade7590c086ecf5f16a432897307b5271d7
7
+ data.tar.gz: 0fb0b9c41cbe659111efcee44fee27a1e698c76b847c80c3238bca6b2a9306115689211b453d6e09cb30ebe3360191eda8f807f29b72a1b2232882e24bc6b5e5
data/lib/typ/formatter.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Typ
2
2
  class Formatter
3
3
  module FormatGate
4
- class Formatter
4
+ class BaseFormatter
5
5
  def initialize gate
6
6
  @gate = gate
7
7
  @string = format
@@ -12,7 +12,9 @@ module Typ
12
12
  def to_s
13
13
  @string
14
14
  end
15
-
15
+ end
16
+
17
+ class FetchFormatter < BaseFormatter
16
18
  def head
17
19
  @head ||= if gate.dsl_key
18
20
  "#{gate.dsl_method} #{gate.dsl_key.inspect} #{gate.dsl_literal.inspect}"
@@ -21,9 +23,6 @@ module Typ
21
23
  end
22
24
  end
23
25
 
24
- def actual
25
- end
26
-
27
26
  def format
28
27
  if gate.ok?
29
28
  Rainbow(head).green
@@ -66,7 +65,7 @@ module Typ
66
65
  end
67
66
  end
68
67
 
69
- class Is < Formatter
68
+ class Is < BaseFormatter
70
69
  def format
71
70
  literal = gate.dsl_literal
72
71
 
@@ -78,7 +77,7 @@ module Typ
78
77
  end
79
78
  end
80
79
 
81
- class IsA < Formatter
80
+ class IsA < BaseFormatter
82
81
  def format
83
82
  string = "is_a #{gate.dsl_literal}"
84
83
 
@@ -90,13 +89,13 @@ module Typ
90
89
  end
91
90
  end
92
91
 
93
- class Its < Formatter
92
+ class Its < FetchFormatter
94
93
  def actual
95
94
  gate.it.send gate.dsl_key
96
95
  end
97
96
  end
98
97
 
99
- class Key < Formatter
98
+ class Key < FetchFormatter
100
99
  def actual
101
100
  gate.it[gate.dsl_key]
102
101
  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.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anatoly Chernov
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-08 00:00:00.000000000 Z
11
+ date: 2023-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typ
@@ -66,7 +66,7 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: 1.9.2
69
- description:
69
+ description:
70
70
  email:
71
71
  - chertoly@gmail.com
72
72
  executables: []
@@ -74,10 +74,10 @@ extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
76
  - lib/typ/formatter.rb
77
- homepage:
77
+ homepage:
78
78
  licenses: []
79
79
  metadata: {}
80
- post_install_message:
80
+ post_install_message:
81
81
  rdoc_options: []
82
82
  require_paths:
83
83
  - lib
@@ -92,8 +92,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
92
  - !ruby/object:Gem::Version
93
93
  version: '0'
94
94
  requirements: []
95
- rubygems_version: 3.4.15
96
- signing_key:
95
+ rubygems_version: 3.4.21
96
+ signing_key:
97
97
  specification_version: 4
98
98
  summary: To format validations made with typs.
99
99
  test_files: []