bcdd-contract 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.rubocop.yml +128 -0
- data/CHANGELOG.md +45 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/LICENSE.txt +21 -0
- data/README.md +964 -0
- data/Rakefile +18 -0
- data/Steepfile +32 -0
- data/examples/README.md +11 -0
- data/examples/anti_corruption_layer/README.md +212 -0
- data/examples/anti_corruption_layer/Rakefile +30 -0
- data/examples/anti_corruption_layer/app/models/payment/charge_credit_card.rb +36 -0
- data/examples/anti_corruption_layer/config.rb +20 -0
- data/examples/anti_corruption_layer/lib/payment_gateways/adapters/circle_up.rb +19 -0
- data/examples/anti_corruption_layer/lib/payment_gateways/adapters/pay_friend.rb +19 -0
- data/examples/anti_corruption_layer/lib/payment_gateways/contract.rb +15 -0
- data/examples/anti_corruption_layer/lib/payment_gateways/response.rb +5 -0
- data/examples/anti_corruption_layer/lib/payment_gateways.rb +11 -0
- data/examples/anti_corruption_layer/vendor/circle_up/client.rb +11 -0
- data/examples/anti_corruption_layer/vendor/pay_friend/client.rb +11 -0
- data/examples/business_processes/README.md +245 -0
- data/examples/business_processes/Rakefile +50 -0
- data/examples/business_processes/config.rb +14 -0
- data/examples/business_processes/lib/division.rb +58 -0
- data/examples/design_by_contract/README.md +227 -0
- data/examples/design_by_contract/Rakefile +60 -0
- data/examples/design_by_contract/config.rb +13 -0
- data/examples/design_by_contract/lib/shopping_cart.rb +62 -0
- data/examples/ports_and_adapters/README.md +246 -0
- data/examples/ports_and_adapters/Rakefile +68 -0
- data/examples/ports_and_adapters/app/models/user/record/repository.rb +13 -0
- data/examples/ports_and_adapters/app/models/user/record.rb +7 -0
- data/examples/ports_and_adapters/config.rb +28 -0
- data/examples/ports_and_adapters/db/setup.rb +16 -0
- data/examples/ports_and_adapters/lib/user/creation.rb +19 -0
- data/examples/ports_and_adapters/lib/user/data.rb +5 -0
- data/examples/ports_and_adapters/lib/user/repository.rb +24 -0
- data/examples/ports_and_adapters/test/user_test/repository.rb +21 -0
- data/lib/bcdd/contract/assertions.rb +21 -0
- data/lib/bcdd/contract/config.rb +25 -0
- data/lib/bcdd/contract/core/checker.rb +37 -0
- data/lib/bcdd/contract/core/checking.rb +38 -0
- data/lib/bcdd/contract/core/factory.rb +32 -0
- data/lib/bcdd/contract/core/proxy.rb +19 -0
- data/lib/bcdd/contract/core.rb +12 -0
- data/lib/bcdd/contract/interface.rb +25 -0
- data/lib/bcdd/contract/list.rb +45 -0
- data/lib/bcdd/contract/map/pairs.rb +47 -0
- data/lib/bcdd/contract/map/schema.rb +50 -0
- data/lib/bcdd/contract/map.rb +10 -0
- data/lib/bcdd/contract/proxy.rb +40 -0
- data/lib/bcdd/contract/registry.rb +67 -0
- data/lib/bcdd/contract/unit/checker.rb +51 -0
- data/lib/bcdd/contract/unit/factory.rb +53 -0
- data/lib/bcdd/contract/unit.rb +40 -0
- data/lib/bcdd/contract/version.rb +7 -0
- data/lib/bcdd/contract.rb +118 -0
- data/lib/bcdd-contract.rb +3 -0
- data/sig/bcdd/contract/assertions.rbs +7 -0
- data/sig/bcdd/contract/config.rbs +15 -0
- data/sig/bcdd/contract/core.rbs +60 -0
- data/sig/bcdd/contract/interface.rbs +12 -0
- data/sig/bcdd/contract/list.rbs +21 -0
- data/sig/bcdd/contract/map.rbs +45 -0
- data/sig/bcdd/contract/proxy.rbs +8 -0
- data/sig/bcdd/contract/registry.rbs +25 -0
- data/sig/bcdd/contract/unit.rbs +39 -0
- data/sig/bcdd/contract.rbs +31 -0
- metadata +116 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module BCDD::Contract
|
|
2
|
+
module List
|
|
3
|
+
class Checking
|
|
4
|
+
include Core::Checking
|
|
5
|
+
|
|
6
|
+
def initialize: (untyped, untyped) -> void
|
|
7
|
+
|
|
8
|
+
def errors_message: () -> ::String
|
|
9
|
+
|
|
10
|
+
private
|
|
11
|
+
|
|
12
|
+
def validate: (untyped, Array[String]) -> void
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
module Checker
|
|
16
|
+
include Core::Checker
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def self.new: (untyped) -> untyped
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
module BCDD::Contract
|
|
2
|
+
module Map
|
|
3
|
+
module Pairs
|
|
4
|
+
class Checking
|
|
5
|
+
include Core::Checking
|
|
6
|
+
|
|
7
|
+
def initialize: (untyped, untyped) -> void
|
|
8
|
+
|
|
9
|
+
def errors_message: () -> ::String
|
|
10
|
+
|
|
11
|
+
private
|
|
12
|
+
|
|
13
|
+
def validate: (untyped, untyped) -> void
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
module Checker
|
|
17
|
+
include Core::Checker
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def self.new: (untyped) -> Module
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
module Schema
|
|
24
|
+
class Checking
|
|
25
|
+
include Core::Checking
|
|
26
|
+
|
|
27
|
+
def initialize: (untyped, untyped) -> void
|
|
28
|
+
|
|
29
|
+
ErrorsMsg: ::Proc
|
|
30
|
+
|
|
31
|
+
def errors_message: () -> ::String
|
|
32
|
+
|
|
33
|
+
private
|
|
34
|
+
|
|
35
|
+
def validate: (untyped, Array[String]) -> void
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
module Checker
|
|
39
|
+
include Core::Checker
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def self.new: (untyped) -> Module
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module BCDD::Contract
|
|
2
|
+
class Registry
|
|
3
|
+
include ::Singleton
|
|
4
|
+
|
|
5
|
+
OPTIONS: ::Set[::Symbol]
|
|
6
|
+
UNIT: ::Symbol
|
|
7
|
+
LIST: ::Symbol
|
|
8
|
+
PAIRS: ::Symbol
|
|
9
|
+
SCHEMA: ::Symbol
|
|
10
|
+
|
|
11
|
+
Kind: ::Proc
|
|
12
|
+
|
|
13
|
+
attr_reader store: ::Hash[::Symbol, ::Hash[::Symbol, untyped]]
|
|
14
|
+
attr_reader names: ::Hash[::Symbol, ::Symbol]
|
|
15
|
+
|
|
16
|
+
def self.instance: () -> Registry
|
|
17
|
+
|
|
18
|
+
def initialize: () -> void
|
|
19
|
+
|
|
20
|
+
def self.write: (untyped, untyped) -> untyped
|
|
21
|
+
def self.fetch: (::Symbol) -> untyped
|
|
22
|
+
def self.unit: (untyped) -> untyped
|
|
23
|
+
def self.read: (::Symbol, ::Symbol) -> untyped
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
module BCDD::Contract
|
|
2
|
+
module Unit
|
|
3
|
+
class Checking
|
|
4
|
+
include Core::Checking
|
|
5
|
+
|
|
6
|
+
def initialize: (::Proc, untyped) -> void
|
|
7
|
+
|
|
8
|
+
def errors_message: () -> ::String
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
module Checker
|
|
12
|
+
include Core::Checker
|
|
13
|
+
|
|
14
|
+
SequenceMapper: ::Proc
|
|
15
|
+
|
|
16
|
+
def & : (untyped) -> ::Module
|
|
17
|
+
|
|
18
|
+
ParallelMapper: ::Proc
|
|
19
|
+
|
|
20
|
+
def | : (untyped) -> ::Module
|
|
21
|
+
|
|
22
|
+
private
|
|
23
|
+
|
|
24
|
+
def compose: (untyped, Proc) -> ::Module
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
module Factory
|
|
28
|
+
def self.new: (untyped) -> untyped
|
|
29
|
+
def self.build: (untyped) -> untyped
|
|
30
|
+
|
|
31
|
+
ArityOneHandler: ::Proc
|
|
32
|
+
|
|
33
|
+
def self.lambda!: (untyped) -> untyped
|
|
34
|
+
def self.type!: (untyped) -> untyped
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def self.new: (untyped) -> ::Module
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
module BCDD
|
|
2
|
+
module Contract
|
|
3
|
+
VERSION: ::String
|
|
4
|
+
|
|
5
|
+
class Error < ::StandardError
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def self.config: () -> Config
|
|
9
|
+
|
|
10
|
+
def self.configuration: { (Config) -> void } -> Config
|
|
11
|
+
|
|
12
|
+
def self.proxy: (always_enabled: bool) { (::Class) -> void } -> ::Class
|
|
13
|
+
|
|
14
|
+
def self.error!: (String) -> void
|
|
15
|
+
|
|
16
|
+
def self.assert!: (untyped, String) { (untyped) -> bool } -> untyped
|
|
17
|
+
def self.refute!: (untyped, String) { (untyped) -> bool } -> untyped
|
|
18
|
+
|
|
19
|
+
def self.assert: (untyped, String) { (untyped) -> bool } -> untyped
|
|
20
|
+
def self.refute: (untyped, String) { (untyped) -> bool } -> untyped
|
|
21
|
+
|
|
22
|
+
def self.new: (untyped) -> untyped
|
|
23
|
+
def self.unit: (untyped) -> untyped
|
|
24
|
+
def self.list: (untyped) -> ::Module
|
|
25
|
+
def self.schema: (Hash[untyped, untyped]) -> ::Module
|
|
26
|
+
def self.pairs: (Hash[untyped, untyped]) -> ::Module
|
|
27
|
+
def self.to_proc: () -> ::Proc
|
|
28
|
+
|
|
29
|
+
def self.[]: (untyped) -> ::Module
|
|
30
|
+
end
|
|
31
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: bcdd-contract
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Rodrigo Serradura
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2024-02-01 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: Reliable contract definition, data validation, and type checking for
|
|
14
|
+
Ruby.
|
|
15
|
+
email:
|
|
16
|
+
- rodrigo.serradura@gmail.com
|
|
17
|
+
executables: []
|
|
18
|
+
extensions: []
|
|
19
|
+
extra_rdoc_files: []
|
|
20
|
+
files:
|
|
21
|
+
- ".rubocop.yml"
|
|
22
|
+
- CHANGELOG.md
|
|
23
|
+
- CODE_OF_CONDUCT.md
|
|
24
|
+
- LICENSE.txt
|
|
25
|
+
- README.md
|
|
26
|
+
- Rakefile
|
|
27
|
+
- Steepfile
|
|
28
|
+
- examples/README.md
|
|
29
|
+
- examples/anti_corruption_layer/README.md
|
|
30
|
+
- examples/anti_corruption_layer/Rakefile
|
|
31
|
+
- examples/anti_corruption_layer/app/models/payment/charge_credit_card.rb
|
|
32
|
+
- examples/anti_corruption_layer/config.rb
|
|
33
|
+
- examples/anti_corruption_layer/lib/payment_gateways.rb
|
|
34
|
+
- examples/anti_corruption_layer/lib/payment_gateways/adapters/circle_up.rb
|
|
35
|
+
- examples/anti_corruption_layer/lib/payment_gateways/adapters/pay_friend.rb
|
|
36
|
+
- examples/anti_corruption_layer/lib/payment_gateways/contract.rb
|
|
37
|
+
- examples/anti_corruption_layer/lib/payment_gateways/response.rb
|
|
38
|
+
- examples/anti_corruption_layer/vendor/circle_up/client.rb
|
|
39
|
+
- examples/anti_corruption_layer/vendor/pay_friend/client.rb
|
|
40
|
+
- examples/business_processes/README.md
|
|
41
|
+
- examples/business_processes/Rakefile
|
|
42
|
+
- examples/business_processes/config.rb
|
|
43
|
+
- examples/business_processes/lib/division.rb
|
|
44
|
+
- examples/design_by_contract/README.md
|
|
45
|
+
- examples/design_by_contract/Rakefile
|
|
46
|
+
- examples/design_by_contract/config.rb
|
|
47
|
+
- examples/design_by_contract/lib/shopping_cart.rb
|
|
48
|
+
- examples/ports_and_adapters/README.md
|
|
49
|
+
- examples/ports_and_adapters/Rakefile
|
|
50
|
+
- examples/ports_and_adapters/app/models/user/record.rb
|
|
51
|
+
- examples/ports_and_adapters/app/models/user/record/repository.rb
|
|
52
|
+
- examples/ports_and_adapters/config.rb
|
|
53
|
+
- examples/ports_and_adapters/db/setup.rb
|
|
54
|
+
- examples/ports_and_adapters/lib/user/creation.rb
|
|
55
|
+
- examples/ports_and_adapters/lib/user/data.rb
|
|
56
|
+
- examples/ports_and_adapters/lib/user/repository.rb
|
|
57
|
+
- examples/ports_and_adapters/test/user_test/repository.rb
|
|
58
|
+
- lib/bcdd-contract.rb
|
|
59
|
+
- lib/bcdd/contract.rb
|
|
60
|
+
- lib/bcdd/contract/assertions.rb
|
|
61
|
+
- lib/bcdd/contract/config.rb
|
|
62
|
+
- lib/bcdd/contract/core.rb
|
|
63
|
+
- lib/bcdd/contract/core/checker.rb
|
|
64
|
+
- lib/bcdd/contract/core/checking.rb
|
|
65
|
+
- lib/bcdd/contract/core/factory.rb
|
|
66
|
+
- lib/bcdd/contract/core/proxy.rb
|
|
67
|
+
- lib/bcdd/contract/interface.rb
|
|
68
|
+
- lib/bcdd/contract/list.rb
|
|
69
|
+
- lib/bcdd/contract/map.rb
|
|
70
|
+
- lib/bcdd/contract/map/pairs.rb
|
|
71
|
+
- lib/bcdd/contract/map/schema.rb
|
|
72
|
+
- lib/bcdd/contract/proxy.rb
|
|
73
|
+
- lib/bcdd/contract/registry.rb
|
|
74
|
+
- lib/bcdd/contract/unit.rb
|
|
75
|
+
- lib/bcdd/contract/unit/checker.rb
|
|
76
|
+
- lib/bcdd/contract/unit/factory.rb
|
|
77
|
+
- lib/bcdd/contract/version.rb
|
|
78
|
+
- sig/bcdd/contract.rbs
|
|
79
|
+
- sig/bcdd/contract/assertions.rbs
|
|
80
|
+
- sig/bcdd/contract/config.rbs
|
|
81
|
+
- sig/bcdd/contract/core.rbs
|
|
82
|
+
- sig/bcdd/contract/interface.rbs
|
|
83
|
+
- sig/bcdd/contract/list.rbs
|
|
84
|
+
- sig/bcdd/contract/map.rbs
|
|
85
|
+
- sig/bcdd/contract/proxy.rbs
|
|
86
|
+
- sig/bcdd/contract/registry.rbs
|
|
87
|
+
- sig/bcdd/contract/unit.rbs
|
|
88
|
+
homepage: https://github.com/b-cdd/contract
|
|
89
|
+
licenses:
|
|
90
|
+
- MIT
|
|
91
|
+
metadata:
|
|
92
|
+
allowed_push_host: https://rubygems.org
|
|
93
|
+
homepage_uri: https://github.com/b-cdd/contract
|
|
94
|
+
source_code_uri: https://github.com/b-cdd/contract
|
|
95
|
+
changelog_uri: https://github.com/b-cdd/contract/blob/main/CHANGELOG.md
|
|
96
|
+
rubygems_mfa_required: 'true'
|
|
97
|
+
post_install_message:
|
|
98
|
+
rdoc_options: []
|
|
99
|
+
require_paths:
|
|
100
|
+
- lib
|
|
101
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
102
|
+
requirements:
|
|
103
|
+
- - ">="
|
|
104
|
+
- !ruby/object:Gem::Version
|
|
105
|
+
version: 2.7.0
|
|
106
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - ">="
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: '0'
|
|
111
|
+
requirements: []
|
|
112
|
+
rubygems_version: 3.5.3
|
|
113
|
+
signing_key:
|
|
114
|
+
specification_version: 4
|
|
115
|
+
summary: Reliable contract definition, data validation, and type checking for Ruby.
|
|
116
|
+
test_files: []
|