corindon 0.4.0 → 0.7.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fdda7809de8ba754d34b1ee6c90af75e23b9700450aa889651859a23ef54aa4d
4
- data.tar.gz: f1df008ae51c1fbe48a1a9554dc6be740d2012525106e0c2aadc41e3737ac651
3
+ metadata.gz: 9899f5321cf96c41569182938051a815f5baed7d04bda1f88a649c21b50df0b3
4
+ data.tar.gz: c6a9495fc8c46760fb5a09780bc8bbc12ae95deb4e0d7331042f7640f0d380d7
5
5
  SHA512:
6
- metadata.gz: d8f2c9c05289f1767bdab134dc959a159540bdd6653622b26d7515bad28010c0b052ac978ed555b37772b70be9ac9b2b108e8124060ff271c2517b4672d5b72a
7
- data.tar.gz: 3ae05c3677e98b24da5c7bf3f13a879d0f1e1350ec49953108cc9c9b16423928c93555dc07b38da55898005e1e43eaffc821dafcef823aaa4d0432267283a016
6
+ metadata.gz: 66590e780392422933ccceb3596bb9e97d4ef6eb9e4d5685847cfe128b5f5d0a196723aa626f5bab711b011dad84a5987fc2b1946dd850b0e255226308bdd18a
7
+ data.tar.gz: bd262475a0fa7d10b565ef357d066db7b94c310eff89188438683ff26322de2fb5bcf87398b676ded30ef0fac18c81d251cb0c0f217ed20208bd02ba96a0629e
@@ -21,4 +21,5 @@ Gem::Specification.new do |s|
21
21
  s.add_development_dependency 'bundler'
22
22
  s.add_development_dependency 'minitest', '~> 5.14'
23
23
  s.add_development_dependency 'rake', '~> 13.0'
24
+ s.add_development_dependency 'rubocop', '1.3.1'
24
25
  end
@@ -3,42 +3,68 @@
3
3
  module Corindon
4
4
  module DependencyInjection
5
5
  class Container
6
- using Ext::Something
6
+ using Something::Ext
7
7
 
8
- attr_reader :id_generator
9
8
  attr_reader :injector
10
9
 
11
- # @param [Id::IdGenerator] id_generator
12
- def initialize(id_generator: Id::UuidGenerator.new)
13
- @id_generator = id_generator
10
+ # @param [Array<Definition>] definitions
11
+ def initialize(definitions: [], parameters: {}, service_built_listeners: [])
14
12
  @services = {}
15
13
  @definitions = {}
16
- @parameters = {}
14
+ @parameters = parameters
17
15
  @tags = Hash.new { |hash, key| hash[key] = [] }
18
16
 
19
17
  @injector = Injector.new(container: self)
18
+
19
+ definitions.each { |d| register_definition(d) }
20
+
21
+ @service_built_listeners = service_built_listeners
22
+ end
23
+
24
+ # @return [Container]
25
+ def dup
26
+ Container.new(
27
+ definitions: definitions.values,
28
+ parameters: parameters.dup,
29
+ service_built_listeners: service_built_listeners
30
+ )
31
+ end
32
+
33
+ # @param [Definition, Injectable, Class]
34
+ # @return [Definition]
35
+ def as_definition(def_or_injectable)
36
+ if def_or_injectable.is_a?(Definition)
37
+ def_or_injectable
38
+ elsif def_or_injectable.is_a?(Injectable)
39
+ def_or_injectable.definition
40
+ elsif def_or_injectable.is_a?(Class)
41
+ Definition.new(def_or_injectable)
42
+ else
43
+ raise StandardError.new("Don't know how to build #{def_or_injectable}")
44
+ end
20
45
  end
21
46
 
22
- # @param [Class] klass
47
+ # @param [Class, Injectable, Definition] def_or_injectable
23
48
  # @return [String]
24
- def add_definition(klass, id: nil, anonymous: false, &block)
25
- definition = if injectable?(klass)
26
- klass.definition
27
- elsif block.sth?
28
- Dsl.new(klass).exec(&block)
29
- else
30
- Definition.new(klass)
31
- end
32
-
33
- # Generate an id if set to anonymous when registering
34
- # If a definition is set to be anonymous but an id is provided zhen registering, use this id instead<
35
- if anonymous || (definition.anonymous? && id.nil?)
36
- id = id_generator.generate
49
+ def add_definition(def_or_injectable, context: {}, &block)
50
+ definition = as_definition(def_or_injectable)
51
+
52
+ if block.sth?
53
+ definition = Dsl.from_definition(definition).exec(context: context, &block)
37
54
  end
38
55
 
39
- id = id || definition.id || to_id(klass)
40
- definitions[id] = definition
41
- definition.tags.each { |tag| tags[tag] << id }
56
+ id = definition.id || to_id(def_or_injectable)
57
+
58
+ register_definition(
59
+ Definition.new(
60
+ definition.object_source,
61
+ id: id,
62
+ args: definition.args,
63
+ kwargs: definition.kwargs,
64
+ calls: definition.calls,
65
+ tags: definition.tags
66
+ )
67
+ )
42
68
 
43
69
  id
44
70
  end
@@ -60,6 +86,11 @@ module Corindon
60
86
  definitions.key?(to_id(key))
61
87
  end
62
88
 
89
+ # Clears all the cache of services
90
+ def clear
91
+ @services = {}
92
+ end
93
+
63
94
  # @param [Class, #to_s] key
64
95
  # @return [Object]
65
96
  def get(key)
@@ -92,26 +123,49 @@ module Corindon
92
123
  parameters.fetch(to_id(key))
93
124
  end
94
125
 
126
+ # @param [Proc{Object, Container}] listener
127
+ def on_service_built(listener)
128
+ service_built_listeners << listener
129
+ end
130
+
95
131
  private
96
132
 
133
+ # @return [Hash{String=>Definition}]
97
134
  attr_reader :definitions
98
135
  attr_reader :parameters
99
136
  attr_reader :services
100
137
  attr_reader :tags
138
+ attr_reader :service_built_listeners
139
+
140
+ def register_definition(definition)
141
+ definitions[definition.id] = definition
142
+ definition.tags.each { |tag| tags[tag] << definition.id }
143
+ end
101
144
 
102
145
  def build_service(id)
103
- definitions.fetch(id).build(injector).tap do |service|
104
- services[id] = service
146
+ service = injector.resolve(definitions.fetch(id)).tap do |svc|
147
+ services[id] = svc
105
148
  end
149
+
150
+ service_built_listeners.each do |listener|
151
+ listener.call(service, self)
152
+ end
153
+
154
+ service
106
155
  end
107
156
 
108
- def injectable?(klass)
109
- klass.is_a?(Class) && klass.ancestors.include?(Injectable)
157
+ def injectable?(object)
158
+ object.is_a?(Injectable)
110
159
  end
111
160
 
112
- # @param [Class, #to_s] key
161
+ # @param [Injectable, Identifiable, Class, Definition, #to_s] key
162
+ # @return [String]
113
163
  def to_id(key)
114
- if key.is_a?(Class)
164
+ if key.is_a?(Definition)
165
+ key.id
166
+ elsif injectable?(key)
167
+ to_id(key.definition)
168
+ elsif key.is_a?(Class)
115
169
  key.name
116
170
  else
117
171
  key.to_s
@@ -5,59 +5,40 @@ require 'semantic'
5
5
  module Corindon
6
6
  module DependencyInjection
7
7
  class Definition
8
- attr_reader :klass
8
+ attr_reader :object_source
9
9
  attr_reader :args
10
10
  attr_reader :kwargs
11
11
  attr_reader :calls
12
12
  attr_reader :tags
13
+ # @return [String]
13
14
  attr_reader :id
14
15
 
15
- def initialize(klass, args: [], kwargs: {}, calls: [], tags: [], id: nil, anonymous: false)
16
- @klass = klass
16
+ def initialize(object_source, args: [], kwargs: {}, calls: [], tags: [], id: nil)
17
+ @object_source = object_source
17
18
  @args = args
18
19
  @kwargs = kwargs
19
20
  @calls = calls
20
21
  @tags = tags
21
22
  @id = id
22
- @anonymous = anonymous
23
23
  end
24
24
 
25
25
  # @param [Injector] injector
26
- # # @return [Object]
26
+ # @return [Object]
27
27
  def build(injector)
28
- object = do_call(klass, :new, injector.resolve(args), injector.resolve(kwargs))
28
+ source = if object_source.is_a?(Class)
29
+ [object_source, :new]
30
+ else
31
+ injector.resolve(object_source)
32
+ end
33
+
34
+ object = RubyCompat.do_call(*source, injector.resolve(args), injector.resolve(kwargs))
29
35
 
30
36
  calls.each do |(call, call_args, call_kwargs)|
31
- do_call(object, call, injector.resolve(call_args), injector.resolve(call_kwargs))
37
+ RubyCompat.do_call(object, call, injector.resolve(call_args), injector.resolve(call_kwargs))
32
38
  end
33
39
 
34
40
  object
35
41
  end
36
-
37
- # @return [Boolean]
38
- def anonymous?
39
- @anonymous
40
- end
41
-
42
- private
43
-
44
- if ::Semantic::Version.new(RUBY_VERSION).satisfies?(">= 2.7.0")
45
- def do_call(obj, method, args, kwargs)
46
- obj.send(method, *args, **kwargs)
47
- end
48
- else
49
- def do_call(obj, method, args, kwargs)
50
- if args.empty? && kwargs.empty?
51
- obj.send(method)
52
- elsif args.empty?
53
- obj.send(method, **kwargs)
54
- elsif kwargs.empty?
55
- obj.send(method, *args)
56
- else
57
- obj.send(method, *args, **kwargs)
58
- end
59
- end
60
- end
61
42
  end
62
43
  end
63
44
  end
@@ -3,22 +3,41 @@
3
3
  module Corindon
4
4
  module DependencyInjection
5
5
  class Dsl
6
+ class << self
7
+ # @param [Definition] definition
8
+ # @return [Dsl]
9
+ def from_definition(definition)
10
+ new(
11
+ definition.object_source,
12
+ id: definition.id,
13
+ args: definition.args,
14
+ kwargs: definition.kwargs,
15
+ calls: definition.calls,
16
+ tags: definition.tags
17
+ )
18
+ end
19
+ end
20
+
6
21
  # @param [Class] klass
7
- def initialize(klass, args: [], kwargs: {}, id: nil, anonymous: false)
22
+ def initialize(klass, args: [], kwargs: {}, id: nil, calls: [], tags: [])
8
23
  @klass = klass
9
24
  @args = args
10
25
  @kwargs = kwargs
11
- @calls = []
12
- @tags = []
26
+ @calls = calls
27
+ @tags = tags
13
28
  @id = id
14
- @anonymous = anonymous
15
29
  end
16
30
 
31
+ # @param [Hash] context
17
32
  # @return [Definition]
18
- def exec(&block)
19
- instance_exec(&block)
33
+ def exec(context: {}, &block)
34
+ if context.is_a?(Hash)
35
+ context = OpenStruct.new(context)
36
+ end
37
+
38
+ instance_exec(context, &block)
20
39
 
21
- Definition.new(@klass, args: @args, kwargs: @kwargs, calls: @calls, tags: @tags, id: @id, anonymous: @anonymous)
40
+ Definition.new(@klass, args: @args, kwargs: @kwargs, calls: @calls, tags: @tags, id: @id)
22
41
  end
23
42
 
24
43
  def args(*arguments, **kv_arguments)
@@ -33,15 +52,9 @@ module Corindon
33
52
 
34
53
  # @param [String] id
35
54
  def id(id)
36
- @anonymous = false
37
55
  @id = id
38
56
  end
39
57
 
40
- def anonymous!
41
- @anonymous = true
42
- @id = nil
43
- end
44
-
45
58
  # @param [Class, #to_s] key
46
59
  # @return [Token::ParameterToken]
47
60
  def param(key)
@@ -3,22 +3,36 @@
3
3
  module Corindon
4
4
  module DependencyInjection
5
5
  module Injectable
6
- def definition
7
- Definition.new(self)
8
- end
9
-
10
6
  refine Class do
7
+ def factory(service, method)
8
+ Token::ServiceFactoryToken.new(service, method)
9
+ end
10
+
11
+ def make_parameter(name)
12
+ Token::ParameterToken.new(key: "#{self.name.downcase.gsub(/::/, '.')}.#{name}")
13
+ end
14
+
15
+ def make_definition(name, source, *args, **kwargs, &block)
16
+ do_make_definition("#{self.name.downcase.gsub(/::/, '.')}.#{name}", source, args: args, kwargs: kwargs, &block)
17
+ end
18
+
11
19
  def injectable(*args, **kwargs, &block)
12
- include Injectable
20
+ extend Injectable
13
21
 
14
22
  define_singleton_method :definition do
23
+ do_make_definition(name, self, args: args, kwargs: kwargs, &block)
24
+ end
25
+ end
26
+
27
+ private
28
+
29
+ def do_make_definition(name, source, args:, kwargs:, &block)
15
30
  if block.nil?
16
- Definition.new(self, args: args, kwargs: kwargs)
31
+ Definition.new(source, args: args, kwargs: kwargs, id: name)
17
32
  else
18
- Dsl.new(self).exec(&block)
33
+ Dsl.new(source, args: args, kwargs: kwargs, id: name).exec(&block)
19
34
  end
20
35
  end
21
- end
22
36
  end
23
37
  end
24
38
  end
@@ -19,6 +19,8 @@ module Corindon
19
19
  value.transform_values(&method(:resolve))
20
20
  elsif value.is_a?(Token::InjectionToken)
21
21
  value.resolve(injector: self)
22
+ elsif value.is_a?(Definition)
23
+ value.build(self)
22
24
  else
23
25
  container.get(value)
24
26
  end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Corindon
4
+ module DependencyInjection
5
+ class RubyCompat
6
+ class << self
7
+ if ::Semantic::Version.new(RUBY_VERSION).satisfies?('>= 2.7.0')
8
+ def do_call(obj, method, args, kwargs)
9
+ obj.send(method, *args, **kwargs)
10
+ end
11
+ else
12
+ def do_call(obj, method, args, kwargs)
13
+ if args.empty? && kwargs.empty?
14
+ obj.send(method)
15
+ elsif args.empty?
16
+ obj.send(method, **kwargs)
17
+ elsif kwargs.empty?
18
+ obj.send(method, *args)
19
+ else
20
+ obj.send(method, *args, **kwargs)
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Corindon
4
+ module DependencyInjection
5
+ module Testing
6
+ # Defines the `mock_definition` on Container allowing to mock services returned by the container for a given Definition
7
+ module MockUtils
8
+ refine Container do
9
+ # Allow to provide a specific value that the definition will resolve to
10
+ # @param [Definition] definition
11
+ # @param [Object] value
12
+ def mock_definition(definition, value)
13
+ singleton_class.prepend MockUtils unless is_a?(MockUtils)
14
+
15
+ add_definition(definition) if !has?(definition)
16
+
17
+ id = to_id(definition)
18
+ mocks[definition] = services[id] = value
19
+ end
20
+ end
21
+
22
+ using self
23
+
24
+ def mocks
25
+ @mocks ||= {}
26
+ end
27
+
28
+ def dup
29
+ new_instance = super
30
+
31
+ mocks.each do |definition, value|
32
+ new_instance.mock_definition(definition, value)
33
+ end
34
+
35
+ new_instance
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -27,33 +27,13 @@ module Corindon
27
27
 
28
28
  # @param [Injector] injector
29
29
  def resolve(injector:)
30
- do_call(
30
+ RubyCompat.do_call(
31
31
  injector.resolve(service),
32
32
  method,
33
33
  injector.resolve(args),
34
34
  injector.resolve(kwargs)
35
35
  )
36
36
  end
37
-
38
- private
39
-
40
- if ::Semantic::Version.new(RUBY_VERSION).satisfies?(">= 2.7.0")
41
- def do_call(obj, method, args, kwargs)
42
- obj.send(method, *args, **kwargs)
43
- end
44
- else
45
- def do_call(obj, method, args, kwargs)
46
- if args.empty? && kwargs.empty?
47
- obj.send(method)
48
- elsif args.empty?
49
- obj.send(method, **kwargs)
50
- elsif kwargs.empty?
51
- obj.send(method, *args)
52
- else
53
- obj.send(method, *args, **kwargs)
54
- end
55
- end
56
- end
57
37
  end
58
38
  end
59
39
  end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Corindon
4
+ module DependencyInjection
5
+ module Token
6
+ class ServiceFactoryToken < InjectionToken
7
+ attr_reader :service
8
+ attr_reader :method
9
+
10
+ def initialize(service, method)
11
+ super()
12
+
13
+ @service = service
14
+ @method = method
15
+ end
16
+
17
+ # @param [Injector] injector
18
+ def resolve(injector:)
19
+ [injector.resolve(service), method]
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -1,15 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Corindon
4
- module Ext
5
- module Guards
4
+ module Guards
5
+ module Ext
6
6
  refine Object do
7
7
  def unimplemented!(message = nil)
8
- raise Error.new(message || "This method is not implemented.")
8
+ raise NotImplementedError.new(message || 'This method is not implemented.')
9
9
  end
10
10
 
11
11
  def unreachable!(message = nil)
12
- raise Error.new(message || "Reached unreachable code.")
12
+ raise StandardError.new(message || 'Reached unreachable code.')
13
13
  end
14
14
  end
15
15
  end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Corindon
4
+ module Result
5
+ module Errors
6
+ class BadReturnTypeError < ResultError
7
+ # @return [Object]
8
+ attr_reader :value
9
+
10
+ # @param [Object] value
11
+ def initialize(value)
12
+ super("Expected a Result, got #{value}")
13
+
14
+ @value = value
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Corindon
4
- module Ext
5
- module Guards
6
- class Error < StandardError
4
+ module Result
5
+ module Errors
6
+ class ResultError < StandardError
7
7
  end
8
8
  end
9
9
  end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Corindon
4
+ module Result
5
+ module Ext
6
+ refine Object do
7
+ def rescue_failure(&block)
8
+ block.call
9
+ rescue StandardError => error
10
+ Corindon::Result::Failure.new(error)
11
+ end
12
+
13
+ # rubocop:disable Naming/MethodName
14
+ def Failure(error)
15
+ Corindon::Result::Failure.new(error)
16
+ end
17
+
18
+ def Success(value)
19
+ Corindon::Result::Success.new(value)
20
+ end
21
+ # rubocop:enable Naming/MethodName
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Corindon
4
+ module Result
5
+ class Failure < Result
6
+ # @return [Exception]
7
+ attr_reader :error
8
+
9
+ # @param [Exception] error
10
+ def initialize(error)
11
+ super()
12
+
13
+ @error = error
14
+ end
15
+
16
+ # @raise [Exception]
17
+ def unwrap!
18
+ raise error
19
+ end
20
+
21
+ # @return [Boolean]
22
+ def failure?
23
+ true
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ using Corindon::Guards::Ext
4
+
5
+ module Corindon
6
+ module Result
7
+ class Result
8
+ # @return [Boolean]
9
+ def success?
10
+ false
11
+ end
12
+
13
+ # @return [Boolean]
14
+ def failure?
15
+ false
16
+ end
17
+
18
+ # @raise [Exception] if called on a Failure
19
+ # @return [Object]
20
+ def unwrap!
21
+ unimplemented!
22
+ end
23
+
24
+ # @yieldparam [Object] value
25
+ # @yieldreturn [Result]
26
+ # @return [Result]
27
+ def and_then(&_block)
28
+ self
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Corindon
4
+ module Result
5
+ class Success < Result
6
+ # @return [Object]
7
+ attr_reader :value
8
+
9
+ # @param [Object] value
10
+ def initialize(value)
11
+ super()
12
+
13
+ @value = value
14
+ end
15
+
16
+ # @return [Boolean]
17
+ def success?
18
+ true
19
+ end
20
+
21
+ # @return [Object]
22
+ def unwrap!
23
+ value
24
+ end
25
+
26
+ def and_then(&block)
27
+ retval = block.call(value)
28
+
29
+ if retval.is_a?(Result)
30
+ retval
31
+ else
32
+ Failure.new(Errors::BadReturnTypeError.new(retval))
33
+ end
34
+ rescue StandardError => error
35
+ Failure.new(error)
36
+ end
37
+ end
38
+ end
39
+ end
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Corindon
4
- module Ext
5
- module Something
4
+ module Something
5
+ module Ext
6
6
  refine Object do
7
7
  def sth?
8
8
  !nil?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Corindon
4
- VERSION = "0.4.0"
4
+ VERSION = '0.7.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: corindon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rémi Piotaix
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-07 00:00:00.000000000 Z
11
+ date: 2021-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: semantic
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '13.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '='
88
+ - !ruby/object:Gem::Version
89
+ version: 1.3.1
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '='
95
+ - !ruby/object:Gem::Version
96
+ version: 1.3.1
83
97
  description:
84
98
  email: remi@piotaix.fr
85
99
  executables: []
@@ -88,25 +102,27 @@ extra_rdoc_files: []
88
102
  files:
89
103
  - corindon.gemspec
90
104
  - lib/corindon.rb
91
- - lib/corindon/console/application.rb
92
- - lib/corindon/console/base_command.rb
93
- - lib/corindon/console/input.rb
94
- - lib/corindon/console/output.rb
95
105
  - lib/corindon/dependency_injection/container.rb
96
106
  - lib/corindon/dependency_injection/definition.rb
97
107
  - lib/corindon/dependency_injection/dsl.rb
98
- - lib/corindon/dependency_injection/id/id_generator.rb
99
- - lib/corindon/dependency_injection/id/uuid_generator.rb
100
108
  - lib/corindon/dependency_injection/injectable.rb
101
109
  - lib/corindon/dependency_injection/injector.rb
110
+ - lib/corindon/dependency_injection/ruby_compat.rb
111
+ - lib/corindon/dependency_injection/testing/mock_utils.rb
102
112
  - lib/corindon/dependency_injection/token/injection_token.rb
103
113
  - lib/corindon/dependency_injection/token/parameter_token.rb
104
114
  - lib/corindon/dependency_injection/token/service_call_token.rb
115
+ - lib/corindon/dependency_injection/token/service_factory_token.rb
105
116
  - lib/corindon/dependency_injection/token/tagged_token.rb
106
117
  - lib/corindon/dependency_injection/token/value_token.rb
107
- - lib/corindon/ext/guards.rb
108
- - lib/corindon/ext/guards/error.rb
109
- - lib/corindon/ext/something.rb
118
+ - lib/corindon/guards/ext.rb
119
+ - lib/corindon/result/errors/bad_return_type_error.rb
120
+ - lib/corindon/result/errors/result_error.rb
121
+ - lib/corindon/result/ext.rb
122
+ - lib/corindon/result/failure.rb
123
+ - lib/corindon/result/result.rb
124
+ - lib/corindon/result/success.rb
125
+ - lib/corindon/something/ext.rb
110
126
  - lib/corindon/version.rb
111
127
  homepage: https://gitlab.com/piotaixr/corindon
112
128
  licenses:
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Corindon
4
- module Console
5
- class Application
6
- attr_reader :commands
7
-
8
- def initialize
9
- @commands = {}
10
- end
11
-
12
- def run(argv); end
13
- end
14
- end
15
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Corindon
4
- module Console
5
- class BaseCommand
6
- configure do |c|
7
- c.name 'blabla'
8
- end
9
-
10
- def run(input, output); end
11
- end
12
- end
13
- end
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Corindon
4
- module Console
5
- class Input
6
- end
7
- end
8
- end
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Corindon
4
- module Console
5
- class Output
6
- end
7
- end
8
- end
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Corindon
4
- module DependencyInjection
5
- module Id
6
- class IdGenerator
7
- # @return [String]
8
- def generate; end
9
- end
10
- end
11
- end
12
- end
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Corindon
4
- module DependencyInjection
5
- module Id
6
- class UuidGenerator < IdGenerator
7
- # @return [String]
8
- def generate
9
- SecureRandom.uuid
10
- end
11
- end
12
- end
13
- end
14
- end