value-object 1.0.0 → 1.0.1
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 +4 -4
- data/lib/exceptions.rb +31 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c06c9216838238473a04c91dd10f38828c9bb60
|
4
|
+
data.tar.gz: 02fb58764951e8e88090a7659ad1ee71e7151c56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dbef2a184499071d99f8acb4cf22950cb811dafcfd47f0614b4cb456218edb1f02482a0bb350c2c77ffa5c179acc20b4340f451d7de75f665e538a3fc4a27acf
|
7
|
+
data.tar.gz: 41fa5f09cd9a4fe99b50b911e47224855e1734d4ea96b19d38501ac035de5b7dc501fc9a1195aa52e2708ce935b0af11edc16ca6ed2c0ebf456727d3002d2ded
|
data/lib/exceptions.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
module ValueObject
|
2
|
+
class NotImplementedInvariant < Exception
|
3
|
+
def initialize(name)
|
4
|
+
super "Invariant #{name} needs to be implemented"
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
class ViolatedInvariant < Exception
|
9
|
+
def initialize(name, wrong_values)
|
10
|
+
super "Fields values " + wrong_values.to_s + " violate invariant: #{name}"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class NotDeclaredFields < Exception
|
15
|
+
def initialize()
|
16
|
+
super "At least one field must be declared"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class FieldWithoutValue < Exception
|
21
|
+
def initialize(fields)
|
22
|
+
super "Declared fields #{fields} must have value"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
class WrongNumberOfArguments < Exception
|
27
|
+
def initialize(fields_number, arguments_number)
|
28
|
+
super "Declared #{fields_number} fields but passing #{arguments_number}"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: value-object
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- No Flop Squad
|
@@ -30,6 +30,7 @@ executables: []
|
|
30
30
|
extensions: []
|
31
31
|
extra_rdoc_files: []
|
32
32
|
files:
|
33
|
+
- lib/exceptions.rb
|
33
34
|
- lib/value_object.rb
|
34
35
|
homepage: http://rubygems.org/gems/value-object
|
35
36
|
licenses:
|