scorpion-ioc 0.5.2 → 0.5.4

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
  SHA1:
3
- metadata.gz: 449b0bb3ad037a6a6f8a58240d36fa3dcc435701
4
- data.tar.gz: 4db64b7b1356846822c8d23359f06c7398cd2cae
3
+ metadata.gz: 6428d2f5e0abe49e6c16b290662aecb892a82fe6
4
+ data.tar.gz: 8f0887e737d14eba6f16783a351e234282297d5e
5
5
  SHA512:
6
- metadata.gz: 88dc269d8d2d3308e64c7ea4705bb2e4ba8a17d41fc65b66debff93f801c2d284c47465231363f25c27a68fb24fbf963f8e8860bcbcc6a8348dbda0659810a9f
7
- data.tar.gz: 2bb0982f0e941f8bce69a050875c4ef52223d00a413faf480cd9cd2d21384abcb22e0d9683e2451ecd87a1d8b962aea89956ae0c8cb34adc675252c6cca8c101
6
+ metadata.gz: 20714b9c65809825c63350841a0099a7d3962eb8c40a17af38758a817ebfc924c8a1babf3d9dad03710ba188f4f942f4b749f8f840b89d90f256479d882c1244
7
+ data.tar.gz: 77282f171a0e64132832256138d0844163bb9fd5c142a98f372d93a31165d67e7526984f92dfe88b354330b7a1751326e9eb6f4763b5597a00d9b3ee27475e65
data/README.md CHANGED
@@ -49,7 +49,7 @@ make them overridable, or just use module mixins.
49
49
 
50
50
  Most of these counter arguments focus on testing, and given how easy it is to
51
51
  mock objects in Ruby, you don't really need a framework. If testing were the
52
- only virtue they'd be spot on. Despite it's virtues DI doesn't come without it's
52
+ only virtue they'd be spot on. Despite its virtues DI doesn't come without its
53
53
  own problems. However for larger projects that you expect to be long-lived, a DI
54
54
  framework may help manage the complexity.
55
55
 
@@ -144,7 +144,7 @@ end
144
144
  ```
145
145
 
146
146
  Here the dependency is clearly defined - and even creates accessors for getting
147
- and setting the weapon. When a Hunter is created it's dependencies are also
147
+ and setting the weapon. When a Hunter is created its dependencies are also
148
148
  created - and any of their dependencies and so on. Usage is equally simple
149
149
 
150
150
  ```ruby
@@ -219,7 +219,7 @@ end
219
219
  zoo = scorpion.fetch Zoo
220
220
  zoo.keeper # => an instance of a Zoo::Keeper
221
221
  zoo.vet? # => false it hasn't been hunted down yet
222
- zoo.vet # => an instnace of a Zoo::Vet
222
+ zoo.vet # => an instance of a Zoo::Vet
223
223
  zoo.keeper.lunch # => an instance of FastFood
224
224
  ```
225
225
 
@@ -405,7 +405,7 @@ Scorpion allows you to capture dependency and feed the same instance to everyone
405
405
  asks for a matching dependency.
406
406
 
407
407
  DI singletons are different then global singletons in that each scorpion can
408
- have a unique instance of the class that it shares with all of it's objects. This
408
+ have a unique instance of the class that it shares with all of its objects. This
409
409
  allows, for example, global variable like support per-request without polluting
410
410
  the global namespace or dealing with thread concurrency issues.
411
411
 
@@ -429,7 +429,7 @@ use `share`.
429
429
 
430
430
  A scorpion nest is where a mother scorpion lives and conceives young -
431
431
  duplicates of the mother but maintaining their own state. The scorpion nest is
432
- used by the Rails integration to give each request it's own scorpion.
432
+ used by the Rails integration to give each request its own scorpion.
433
433
 
434
434
  All preparation performed by the mother is shared with all the children it
435
435
  conceives so that configuration is established when the application starts.
@@ -103,7 +103,12 @@ module Scorpion
103
103
  Scorpion::Dependency::BuilderDependency.new( contract, traits, with )
104
104
  elsif block_given?
105
105
  Scorpion::Dependency::BuilderDependency.new( contract, traits, builder )
106
- elsif contract.respond_to?( :create )
106
+
107
+ # Allow a Class/Module to define a #create method that will resolve
108
+ # and return an instance of itself. Do not automatically inherit the
109
+ # #create method so only consider it if the owner of the method is the
110
+ # contract itself.
111
+ elsif contract.respond_to?( :create ) && contract.singleton_methods( false ).include?( :create )
107
112
  Scorpion::Dependency::BuilderDependency.new( contract, traits ) do |hunt,*args,**dependencies,&block|
108
113
  if dependencies.present?
109
114
  contract.create hunt, *args, **dependencies, &block
@@ -11,9 +11,7 @@ module Scorpion
11
11
  # Setup dependency injection
12
12
  base.send :include, Scorpion::Object
13
13
  base.send :include, Scorpion::Rails::Nest
14
- base.send :around_perform do |job, block|
15
- job.send :with_scorpion, &block
16
- end
14
+ base.send :around_perform, :with_scorpion
17
15
 
18
16
  super
19
17
  end
@@ -11,9 +11,7 @@ module Scorpion
11
11
  # Setup dependency injection
12
12
  base.send :include, Scorpion::Object
13
13
  base.send :include, Scorpion::Rails::Nest
14
- base.send :around_filter do |mailer, block|
15
- mailer.with_scorpion &block
16
- end
14
+ base.send :around_filter, :with_scorpion
17
15
 
18
16
  super
19
17
  end
@@ -1,5 +1,5 @@
1
1
  module Scorpion
2
- VERSION_NUMBER = "0.5.2"
2
+ VERSION_NUMBER = "0.5.4"
3
3
  VERSION_SUFFIX = ""
4
4
  VERSION = "#{VERSION_NUMBER}#{VERSION_SUFFIX}"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scorpion-ioc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Alexander