sinject 0.2.4 → 1.0.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 +4 -4
- data/.DS_Store +0 -0
- data/.idea/.rakeTasks +7 -0
- data/.idea/misc.xml +4 -0
- data/.idea/modules.xml +8 -0
- data/.idea/sinject.iml +25 -0
- data/.idea/vcs.xml +6 -0
- data/.idea/workspace.xml +831 -0
- data/README.md +14 -16
- data/lib/sinject.rb +5 -248
- data/lib/sinject/class.rb +25 -0
- data/lib/sinject/container.rb +174 -0
- data/lib/sinject/container_item.rb +9 -0
- data/lib/sinject/dependency_group.rb +17 -0
- data/lib/sinject/exceptions.rb +64 -0
- data/lib/sinject/version.rb +1 -1
- metadata +14 -2
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
module Sinject
|
|
2
|
+
class DependencyContractMissingMethodsException < StandardError
|
|
3
|
+
def initialize(methods)
|
|
4
|
+
@methods = methods
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def to_s
|
|
8
|
+
method_names = @methods.join(', ')
|
|
9
|
+
"The following methods have not been implemented: '#{method_names}'"
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
class DependencyContractInvalidParametersException < StandardError
|
|
14
|
+
def initialize(method, parameters)
|
|
15
|
+
@method = method
|
|
16
|
+
@parameters = parameters
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def to_s
|
|
20
|
+
parameter_names = @parameters.join(', ')
|
|
21
|
+
"The method signature of method: '#{@method}' does not match the contract parameters: '#{parameter_names}'"
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
class DependencyInitializeException < StandardError
|
|
26
|
+
|
|
27
|
+
def initialize(expected_type)
|
|
28
|
+
@expected_type = expected_type
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def to_s
|
|
32
|
+
"The custom dependency initializer does not return an object of the expected type: '#{@expected_type}'"
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
class DependencyRegistrationException < StandardError
|
|
38
|
+
|
|
39
|
+
def initialize(key)
|
|
40
|
+
@key = key
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def to_s
|
|
44
|
+
"A Dependency has already been registered for the key: '#{key}'"
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
class DependencyRegistrationKeyNotSpecifiedException < StandardError
|
|
50
|
+
|
|
51
|
+
def to_s
|
|
52
|
+
"A key must be specified to register a dependency."
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
class DependencyRegistrationClassNotSpecifiedException < StandardError
|
|
58
|
+
|
|
59
|
+
def to_s
|
|
60
|
+
"A dependency class must be specified to register a dependency."
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
end
|
|
64
|
+
end
|
data/lib/sinject/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sinject
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 1.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- vaughan britton
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-
|
|
11
|
+
date: 2016-04-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -59,7 +59,14 @@ executables: []
|
|
|
59
59
|
extensions: []
|
|
60
60
|
extra_rdoc_files: []
|
|
61
61
|
files:
|
|
62
|
+
- ".DS_Store"
|
|
62
63
|
- ".gitignore"
|
|
64
|
+
- ".idea/.rakeTasks"
|
|
65
|
+
- ".idea/misc.xml"
|
|
66
|
+
- ".idea/modules.xml"
|
|
67
|
+
- ".idea/sinject.iml"
|
|
68
|
+
- ".idea/vcs.xml"
|
|
69
|
+
- ".idea/workspace.xml"
|
|
63
70
|
- ".rspec"
|
|
64
71
|
- CODE_OF_CONDUCT.md
|
|
65
72
|
- Gemfile
|
|
@@ -69,6 +76,11 @@ files:
|
|
|
69
76
|
- bin/console
|
|
70
77
|
- bin/setup
|
|
71
78
|
- lib/sinject.rb
|
|
79
|
+
- lib/sinject/class.rb
|
|
80
|
+
- lib/sinject/container.rb
|
|
81
|
+
- lib/sinject/container_item.rb
|
|
82
|
+
- lib/sinject/dependency_group.rb
|
|
83
|
+
- lib/sinject/exceptions.rb
|
|
72
84
|
- lib/sinject/version.rb
|
|
73
85
|
- sinject.gemspec
|
|
74
86
|
homepage: https://github.com/vaughanbrittonsage/sinject
|