lab42_basic_constraints 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c88af59f506668cbc7c56fffc54c3430f31a0ebf5ad7d697dd3aadebf6ef5192
4
- data.tar.gz: 84bedc52d927607fbdbc5d108d56d23ab02d8931fb939567a06ece934c9903a5
3
+ metadata.gz: e1670a94a94e7a862d42f660df6b15c38efd8aada76025516353d73c8f146a48
4
+ data.tar.gz: e7620b5d6b2ae1813d17cff3cce12fa6a935728f24d612d2a36451bc526dfcf2
5
5
  SHA512:
6
- metadata.gz: 27926e413ebcf7801f572816d6fe5d23ad340d972526ca4d25246e927d118e7073d789b6f167c61c569067097c0bf761b1a707d151320d30400bbb19558e3113
7
- data.tar.gz: f49c25cdf9c96bc9e0da08d7e7783774dd0c511a814a0431360bdb88a208c836cf15d6b35beb3469558ed93a5674377d56993b1b509e4cb9fe13260f65a20632
6
+ metadata.gz: 5416abb445fd45109ad28acc167c842d801467119469fcf4d1ffc81de578daab6cdfc5c361e018079bc23bfaa762860289cb09516b267c8621bee1262c398657
7
+ data.tar.gz: '0148614a24de35f98bc4f997dae7388492f386e1ab980f90e4835ea94ae3c7da00c8741f3063e6028575e430b34deccb9dba89a6debec79feeff87c3bc77b9a0'
data/README.md CHANGED
@@ -115,6 +115,30 @@ Example: Illegal Dates
115
115
  expect( message ).to eq("2020-00-01 is not a legal date")
116
116
  ```
117
117
 
118
+ ## Context Equality More Of A Tricky Sticker
119
+
120
+ And Most Surprisingly
121
+
122
+ ```ruby
123
+ expect(BC.bool).not_to eq(BC.bool)
124
+ ```
125
+
126
+ However in many cases the name and the default say a lot about a constraint's behavior
127
+
128
+ Given
129
+ ```ruby
130
+ let(:natural) {BC.non_negative_int}
131
+ let(:def42) {BC.non_negative_int.set_default(42)}
132
+ ```
133
+
134
+ Then we can compare as follows
135
+ ```ruby
136
+ expect( natural.name ).to eq(BC.non_negative_int.name)
137
+ expect( natural.default ).to eq(0)
138
+ expect( def42.name ).to eq(BC.non_negative_int.name)
139
+ expect( def42.default ).to eq(42)
140
+ ```
141
+
118
142
  # LICENSE
119
143
 
120
144
  Copyright 2020 Robert Dober robert.dober@gmail.com
@@ -5,6 +5,7 @@ module Lab42
5
5
  ConstraintError = Class.new RuntimeError
6
6
  MissingDefaultError = Class.new RuntimeError
7
7
  class Constraint
8
+ attr_reader :default, :name
8
9
 
9
10
  def call value
10
11
  return Result.ok if @constraint.(value)
@@ -1,5 +1,5 @@
1
1
  module Lab42
2
2
  module BasicConstraints
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lab42_basic_constraints
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Dober
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-18 00:00:00.000000000 Z
11
+ date: 2020-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lab42_result
@@ -112,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  - !ruby/object:Gem::Version
113
113
  version: '0'
114
114
  requirements: []
115
- rubygems_version: 3.1.2
115
+ rubygems_version: 3.1.4
116
116
  signing_key:
117
117
  specification_version: 4
118
118
  summary: Basic, useful and recurring constraints