scorpion-ioc 0.6.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +144 -30
  3. data/Gemfile +17 -13
  4. data/README.md +24 -69
  5. data/Rakefile +12 -0
  6. data/app/README +1 -0
  7. data/bin/rspec +2 -1
  8. data/config.ru +2 -2
  9. data/config/environment.rb +1 -0
  10. data/lib/scorpion-ioc.rb +3 -1
  11. data/lib/scorpion.rb +32 -45
  12. data/lib/scorpion/attribute.rb +14 -34
  13. data/lib/scorpion/attribute_set.rb +11 -13
  14. data/lib/scorpion/chain_hunter.rb +4 -4
  15. data/lib/scorpion/dependency.rb +22 -58
  16. data/lib/scorpion/dependency/argument_dependency.rb +4 -4
  17. data/lib/scorpion/dependency/builder_dependency.rb +5 -5
  18. data/lib/scorpion/dependency/captured_dependency.rb +4 -6
  19. data/lib/scorpion/dependency/class_dependency.rb +3 -17
  20. data/lib/scorpion/dependency/module_dependency.rb +1 -1
  21. data/lib/scorpion/dependency_map.rb +16 -16
  22. data/lib/scorpion/error.rb +12 -9
  23. data/lib/scorpion/hunt.rb +33 -34
  24. data/lib/scorpion/hunter.rb +6 -6
  25. data/lib/scorpion/locale/en.yml +2 -2
  26. data/lib/scorpion/method.rb +11 -1
  27. data/lib/scorpion/object.rb +16 -31
  28. data/lib/scorpion/rack.rb +1 -1
  29. data/lib/scorpion/rack/middleware.rb +2 -1
  30. data/lib/scorpion/rails.rb +6 -6
  31. data/lib/scorpion/rails/active_record.rb +4 -4
  32. data/lib/scorpion/rails/active_record/association.rb +3 -3
  33. data/lib/scorpion/rails/active_record/relation.rb +3 -2
  34. data/lib/scorpion/rails/controller.rb +2 -2
  35. data/lib/scorpion/rails/job.rb +1 -1
  36. data/lib/scorpion/rails/mailer.rb +1 -1
  37. data/lib/scorpion/rails/nest.rb +11 -11
  38. data/lib/scorpion/rails/railtie.rb +2 -2
  39. data/lib/scorpion/rspec.rb +2 -2
  40. data/lib/scorpion/rspec/helper.rb +3 -3
  41. data/lib/scorpion/stinger.rb +19 -18
  42. data/lib/scorpion/version.rb +3 -3
  43. data/scorpion.gemspec +13 -13
  44. data/spec/internal/db/schema.rb +1 -1
  45. data/spec/lib/scorpion/attribute_set_spec.rb +4 -22
  46. data/spec/lib/scorpion/attribute_spec.rb +3 -8
  47. data/spec/lib/scorpion/chain_hunter_spec.rb +1 -1
  48. data/spec/lib/scorpion/dependency/argument_dependency_spec.rb +3 -7
  49. data/spec/lib/scorpion/dependency/builder_dependency_spec.rb +7 -7
  50. data/spec/lib/scorpion/dependency/module_dependency_spec.rb +3 -3
  51. data/spec/lib/scorpion/dependency_map_spec.rb +4 -25
  52. data/spec/lib/scorpion/dependency_spec.rb +18 -45
  53. data/spec/lib/scorpion/error_spec.rb +1 -1
  54. data/spec/lib/scorpion/hunt_spec.rb +16 -28
  55. data/spec/lib/scorpion/hunter_spec.rb +29 -21
  56. data/spec/lib/scorpion/object_spec.rb +20 -19
  57. data/spec/lib/scorpion/rack/middleware_spec.rb +4 -4
  58. data/spec/lib/scorpion/rack_spec.rb +1 -1
  59. data/spec/lib/scorpion/rails/active_record/association_spec.rb +3 -3
  60. data/spec/lib/scorpion/rails/active_record/model_spec.rb +3 -3
  61. data/spec/lib/scorpion/rails/active_record/relation_spec.rb +3 -3
  62. data/spec/lib/scorpion/rails/controller_spec.rb +8 -8
  63. data/spec/lib/scorpion/rails/job_spec.rb +1 -1
  64. data/spec/lib/scorpion/rspec/helper_spec.rb +11 -11
  65. data/spec/lib/scorpion_spec.rb +1 -1
  66. data/spec/spec_helper.rb +8 -10
  67. metadata +6 -6
  68. data/lib/scorpion/object_constructor.rb +0 -79
  69. data/spec/lib/scorpion/object_constructor_spec.rb +0 -124
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e78bdb2ec8c0aa512d1bf013af5f3f8840160451
4
- data.tar.gz: 04a5ae8792c19f7e82d44734bd42aa112bace532
3
+ metadata.gz: a82fd90f1ee52beb70fae54e337e99c4f707d250
4
+ data.tar.gz: 9f043a828f235431483c7f316deee1304c5e523d
5
5
  SHA512:
6
- metadata.gz: a0425996d682925ff6bd4b38c676ba011e341bbd534f36e9de083f449cc1ed352a6302013d78077321640595fd6d1caa7ffd717e23746b9666684139b8b45d26
7
- data.tar.gz: 739a23a53b35c0094e3f26bc720bc7ec5365bac68c137cc13ce539f5535e9137188ad41ada269ef392448d1758b7fc428bd9accb8d11abee2d04fee9990664e9
6
+ metadata.gz: ef68c508a7cd4ae4f6eefa03c3453c73a699131931f2f9db833932cca966e64c1382e517cbf703052a6ff569e0a01370fdeec667a9d9e3ec641c046ab96a17b1
7
+ data.tar.gz: 12fba27a0a219c6a7db956b315d260635806cd7a265f53a11556371353fe0502d2d00ee3c16c31e73b68786771d6d9cc415f7ee8105f139c85929e671ab5e879
data/.rubocop.yml CHANGED
@@ -1,62 +1,176 @@
1
- Style/LineLength:
1
+ AllCops:
2
+ TargetRubyVersion: 2.4
3
+
4
+ Exclude:
5
+ - "**/node_modules/**/*"
6
+ - "api/bin/*"
7
+ - "api/db/schema.rb"
8
+ - "api/vendor/**/*"
9
+ - ".*"
10
+ - "/**/.*"
11
+
12
+
13
+ Bundler/OrderedGems:
14
+ Enabled: false
15
+
16
+ Style/EmptyMethod:
17
+ Enabled: false
18
+
19
+ Style/ParallelAssignment:
20
+ Enabled: false
21
+
22
+ Lint/AmbiguousBlockAssociation:
23
+ Enabled: false
24
+
25
+ Lint/UselessAccessModifier:
26
+ Enabled: false
27
+
28
+ Lint/AmbiguousRegexpLiteral:
29
+ Enabled: false
30
+
31
+ Lint/AssignmentInCondition:
32
+ Enabled: false
33
+
34
+ Lint/UnusedMethodArgument:
35
+ Enabled: false
36
+
37
+ Lint/AmbiguousOperator:
38
+ Enabled: false
39
+
40
+ Metrics/ClassLength:
41
+ Max: 500
42
+
43
+ Metrics/LineLength:
2
44
  Max: 120
3
45
 
4
- Style/AccessModifierIndentation:
5
- EnforceStyle: indent
46
+ Metrics/MethodLength:
47
+ Max: 25
48
+
49
+ Metrics/AbcSize:
50
+ Max: 24
6
51
 
7
- Style/IndentationConsistency:
52
+ Metrics/CyclomaticComplexity:
53
+ Max: 10
54
+
55
+ Metrics/ModuleLength:
56
+ Max: 500
57
+
58
+ Metrics/ParameterLists:
59
+ CountKeywordArgs: false
60
+
61
+ Metrics/BlockLength:
8
62
  Enabled: false
9
63
 
10
- Style/TrailingBlankLines:
64
+ Style/Alias:
11
65
  Enabled: false
12
66
 
13
- Style/EmptyLinesAroundBody:
67
+ Layout/CommentIndentation:
14
68
  Enabled: false
15
69
 
16
- Style/StringLiterals:
70
+ Layout/EmptyLines:
71
+ Enabled: false
72
+
73
+ Layout/EmptyLinesAroundBlockBody:
74
+ Enabled: false
75
+
76
+ Layout/EmptyLinesAroundClassBody:
77
+ Enabled: false
78
+
79
+ Layout/EmptyLinesAroundModuleBody:
80
+ Enabled: false
81
+
82
+ Style/FrozenStringLiteralComment:
83
+ Enabled: false
84
+
85
+ Style/DoubleNegation:
17
86
  Enabled: false
18
87
 
19
- Style/SpaceInsideParens:
88
+ Style/Documentation:
20
89
  Enabled: false
21
90
 
22
- Style/SpaceBeforeBlockBraces:
91
+ Style/GuardClause:
23
92
  Enabled: false
24
93
 
25
- Style/SpaceInsideBlockBraces:
94
+ Style/HashSyntax:
26
95
  Enabled: false
27
96
 
28
- Style/SpaceInsideBrackets:
97
+ Layout/IndentArray:
29
98
  Enabled: false
30
99
 
31
- Style/SingleLineBlockParams:
100
+ Layout/IndentationConsistency:
32
101
  Enabled: false
33
102
 
34
- Style/SingleSpaceBeforeFirstArg:
103
+ Layout/IndentationWidth:
35
104
  Enabled: false
36
105
 
37
- Style/TrailingComma:
106
+ Style/Lambda:
38
107
  Enabled: false
39
108
 
40
- Style/SpaceAfterComma:
109
+ Style/FrozenStringLiteralComment:
41
110
  Enabled: false
42
111
 
43
- Style/ClassAndModuleChildren:
44
- EnforcedStyle: nested
112
+ Style/MultilineBlockChain:
113
+ Enabled: false
114
+
115
+ Style/NumericPredicate:
116
+ Enabled: false
117
+
118
+ Style/NumericLiterals:
119
+ Enabled: false
120
+
121
+ Style/OptionHash:
122
+ Enabled: true
123
+
124
+ Style/RegexpLiteral:
125
+ Enabled: false
126
+
127
+ Style/SignalException:
128
+ Enabled: false
129
+
130
+ Layout/SpaceAroundBlockParameters:
131
+ Enabled: false
45
132
 
46
133
  Style/PercentLiteralDelimiters:
47
- PreferredDelimiters:
48
- '%': '{}'
49
- '%i': '{}'
50
- '%q': '{}'
51
- '%Q': '{}'
52
- '%r': '{}'
53
- '%s': '{}'
54
- '%w': '{}'
55
- '%W': '{}'
56
- '%x': '{}'
134
+ Enabled: false
57
135
 
58
- Lint/AssignmentInCondition:
136
+ Layout/SpaceAroundOperators:
59
137
  Enabled: false
60
138
 
61
- Lint/AmbiguousRegexpLiteral:
62
- Enabled: false
139
+ Layout/SpaceInsideBrackets:
140
+ Enabled: false
141
+
142
+ Layout/SpaceInsideParens:
143
+ Enabled: false
144
+
145
+ Layout/SpaceInsideStringInterpolation:
146
+ EnforcedStyle: space
147
+
148
+ Layout/SpaceInsidePercentLiteralDelimiters:
149
+ Enabled: false
150
+
151
+ Style/SpecialGlobalVars:
152
+ Enabled: false
153
+
154
+ Style/SymbolArray:
155
+ Enabled: false
156
+
157
+ Style/StringLiterals:
158
+ EnforcedStyle: double_quotes
159
+
160
+ Layout/TrailingBlankLines:
161
+ Enabled: false
162
+
163
+ Style/TrailingCommaInLiteral:
164
+ Enabled: false
165
+
166
+ Style/WhileUntilModifier:
167
+ Enabled: false
168
+
169
+ Style/UnneededInterpolation:
170
+ Enabled: false
171
+
172
+ Style/CaseEquality:
173
+ Enabled: false
174
+
175
+ Style/WordArray:
176
+ Enabled: false
data/Gemfile CHANGED
@@ -1,21 +1,25 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in scorpion.gemspec
4
4
  gemspec
5
5
 
6
6
  group :test do
7
7
 
8
- gem 'guard', '~> 2.12.8'
9
- gem 'spring'
10
- gem 'byebug'
11
- gem 'pry-byebug'
12
- gem 'guard-rspec'
13
- gem 'fuubar'
14
- gem 'yard'
15
- gem 'simplecov'
16
- gem 'ruby_gntp', '~> 0.3.4'
17
- gem 'awesome_print'
18
- gem 'nokogiri', '1.6.7.2'
8
+ gem "rails", "~> 4.2"
9
+
10
+ gem "guard", "~> 2.12.8"
11
+ gem "spring"
12
+ gem "byebug"
13
+ gem "pry-byebug"
14
+ gem "guard-rspec"
15
+ gem "fuubar"
16
+ gem "yard"
17
+ gem "simplecov"
18
+ gem "ruby_gntp", "~> 0.3.4"
19
+ gem "awesome_print"
20
+ gem "nokogiri", "1.6.7.2"
21
+
22
+ gem "rubocop", "~> 0.50.0"
19
23
 
20
24
  gem "codeclimate-test-reporter", require: nil
21
- end
25
+ end
data/README.md CHANGED
@@ -10,29 +10,30 @@ Add IoC to rails with minimal fuss and ceremony.
10
10
 
11
11
  (Also check out [shog](http://github.com/phallguy/shog) for better rails logs)
12
12
 
13
- <!-- MarkdownTOC depth=4 -->
14
-
15
- - [Dependency Injection](#dependency-injection)
16
- - [Why might you _Want_ a DI FRamework?](#why-might-you-_want_-a-di-framework)
17
- - [Using a Framework...like Scorpion](#using-a-frameworklike-scorpion)
18
- - [Using Scorpion](#using-scorpion)
19
- - [Objects](#objects)
20
- - [Configuration](#configuration)
21
- - [Classes](#classes)
22
- - [Modules](#modules)
23
- - [Traits](#traits)
24
- - [Builders](#builders)
25
- - [Hunting Delegates](#hunting-delegates)
26
- - [Singletons](#singletons)
27
- - [Nests](#nests)
28
- - [Rails](#rails)
29
- - [ActionController](#actioncontroller)
30
- - [ActiveJob](#activejob)
31
- - [ActiveRecord](#activerecord)
32
- - [Contributing](#contributing)
33
- - [License](#license)
34
-
35
- <!-- /MarkdownTOC -->
13
+ <!-- vim-markdown-toc GFM -->
14
+
15
+ * [Dependency Injection](#dependency-injection)
16
+ * [Why might you _Want_ a DI FRamework?](#why-might-you-_want_-a-di-framework)
17
+ * [Setter/Default Injection](#setterdefault-injection)
18
+ * [Constructor/Ignorant Injection](#constructorignorant-injection)
19
+ * [Using a Framework...like Scorpion](#using-a-frameworklike-scorpion)
20
+ * [Using Scorpion](#using-scorpion)
21
+ * [Objects](#objects)
22
+ * [Configuration](#configuration)
23
+ * [Classes](#classes)
24
+ * [Modules](#modules)
25
+ * [Builders](#builders)
26
+ * [Hunting Delegates](#hunting-delegates)
27
+ * [Singletons](#singletons)
28
+ * [Nests](#nests)
29
+ * [Rails](#rails)
30
+ * [ActionController](#actioncontroller)
31
+ * [ActiveJob](#activejob)
32
+ * [ActiveRecord](#activerecord)
33
+ * [Contributing](#contributing)
34
+ * [License](#license)
35
+
36
+ <!-- vim-markdown-toc -->
36
37
 
37
38
  ## Dependency Injection
38
39
 
@@ -290,52 +291,6 @@ poker = scorpion.fetch Sharp
290
291
  poker.poke # => "Sword"
291
292
  ```
292
293
 
293
- #### Traits
294
-
295
- Traits can be used to distinguish between dependencies of the same type. For
296
- example a scorpion may be prepared to hunt for several weapons and the object
297
- needs a blunt weapon.
298
-
299
- ```ruby
300
- class Weapon; end
301
- class Mace < Weapon; end
302
- class Hammer < Weapon; end
303
- class Sword < Weapon; end
304
-
305
- scorpion.prepare do
306
- hunt_for Hammer, :blunt
307
- hunt_for Sword, :sharp
308
- hunt_for Mace, :blunt, :sharp
309
- end
310
-
311
- scorpion.fetch Weapon, :blunt # => Hammer.new
312
- scorpion.fetch Weapon, :sharp # => Sword.new
313
- scorpion.fetch Weapon, :sharp, :blunt # => Mace.new
314
- ```
315
-
316
- Modules can also be used to identify specific traits desired from the hunted
317
- dependency.
318
-
319
- ```ruby
320
- module Color; end
321
- module Streaming; end
322
- class Logger; end
323
- class Console < Logger
324
- include Color
325
- end
326
- class SysLog < Logger
327
- include Streaming
328
- end
329
-
330
- scorpion.prepare do
331
- hunt_for Console
332
- hunt_for SysLog
333
- end
334
-
335
- scorpion.fetch Logger, Color # => Console.new
336
- scorpion.fetch Logger, Streaming # => SysLog.new
337
- ```
338
-
339
294
  #### Builders
340
295
 
341
296
  Sometimes resolving the correct dependencies is a bit more dynamic. In those
data/Rakefile CHANGED
@@ -1,2 +1,14 @@
1
1
  require "bundler/gem_tasks"
2
2
 
3
+ desc "Run the specs"
4
+ task :specs do
5
+ system "rspec"
6
+ end
7
+
8
+ desc "Run linters on the codebase"
9
+ task :lint do
10
+ system "rubocop"
11
+ end
12
+
13
+ task :default => [ :lint, :specs ]
14
+ task :release => [ :default ]
data/app/README ADDED
@@ -0,0 +1 @@
1
+ Here to make vim-rails work
data/bin/rspec CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
+
3
4
  #
4
5
  # This file was generated by Bundler.
5
6
  #
@@ -9,7 +10,7 @@
9
10
 
10
11
  require "pathname"
11
12
  ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12
- Pathname.new(__FILE__).realpath)
13
+ Pathname.new(__FILE__).realpath)
13
14
 
14
15
  require "rubygems"
15
16
  require "bundler/setup"
data/config.ru CHANGED
@@ -1,5 +1,5 @@
1
- require 'rubygems'
2
- require 'bundler'
1
+ require "rubygems"
2
+ require "bundler"
3
3
 
4
4
  Bundler.require :default, :development
5
5
 
@@ -0,0 +1 @@
1
+ # Dummy file to make vim-rails work
data/lib/scorpion-ioc.rb CHANGED
@@ -1 +1,3 @@
1
- require 'scorpion'
1
+ # rubocop:disable Naming/FileName
2
+ # Required case to support autorequire in gems.
3
+ require "scorpion"
data/lib/scorpion.rb CHANGED
@@ -1,50 +1,41 @@
1
- require 'i18n'
1
+ require "i18n"
2
2
 
3
- I18n.load_path += Dir[ File.expand_path( '../scorpion/locale/*.yml', __FILE__ ) ]
3
+ I18n.load_path += Dir[ File.expand_path( "../scorpion/locale/*.yml", __FILE__ ) ]
4
4
 
5
5
  module Scorpion
6
6
 
7
- require 'scorpion/version'
8
- require 'scorpion/error'
9
- require 'scorpion/method'
10
- require 'scorpion/object'
11
- require 'scorpion/object_constructor'
12
- require 'scorpion/attribute_set'
13
- require 'scorpion/hunter'
14
- require 'scorpion/chain_hunter'
15
- require 'scorpion/dependency_map'
16
- require 'scorpion/hunt'
17
- require 'scorpion/dependency'
18
- require 'scorpion/nest'
19
- require 'scorpion/stinger'
20
- require 'scorpion/rails'
21
-
22
- # Hunts for an object that satisfies the requested `contract` and `traits`.
7
+ require "scorpion/version"
8
+ require "scorpion/error"
9
+ require "scorpion/method"
10
+ require "scorpion/object"
11
+ require "scorpion/attribute_set"
12
+ require "scorpion/hunter"
13
+ require "scorpion/chain_hunter"
14
+ require "scorpion/dependency_map"
15
+ require "scorpion/hunt"
16
+ require "scorpion/dependency"
17
+ require "scorpion/nest"
18
+ require "scorpion/stinger"
19
+ require "scorpion/rails"
20
+
21
+ # Hunts for an object that satisfies the requested `contract`.
22
+ #
23
23
  # @param [Class,Module,Symbol] contract describing the desired behavior of the dependency.
24
- # @param [Array<Symbol>] traits required of the dependency
25
- # @param [Hash<Symbol,Object>] dependencies to inject into the object.
26
- # @return [Object] an object that satisfies the contract and traits.
24
+ # @return [Object] an object that satisfies the contract.
27
25
  # @raise [UnsuccessfulHunt] if a matching object cannot be found.
28
- def fetch_by_traits( contract, traits, *arguments, **dependencies, &block )
29
- hunt = Hunt.new( self, contract, traits, *arguments, **dependencies, &block )
26
+ def fetch( contract, *arguments, &block )
27
+ hunt = Hunt.new( self, contract, *arguments, &block )
30
28
  execute hunt
31
29
  end
32
30
 
33
- # Hunts for an object that satisfies the requested `contract` regardless of
34
- # traits.
35
- # @see #fetch_by_traits
36
- def fetch( contract, *arguments, **dependencies, &block )
37
- fetch_by_traits( contract, nil, *arguments, **dependencies, &block )
38
- end
39
-
40
31
  # Creates a new object and feeds it it's dependencies.
41
32
  # @param [Class] object_class a class that includes {Scorpion::Object}.
42
33
  # @param [Array<Object>] args to pass to the constructor.
43
34
  # @param [#call] block to pass to the constructor.
44
35
  # @return [Scorpion::Object] the spawned object.
45
- def spawn( hunt, object_class, *arguments, **dependencies, &block )
36
+ def spawn( hunt, object_class, *arguments, &block )
46
37
  if object_class < Scorpion::Object
47
- object_class.spawn hunt, *arguments, **dependencies, &block
38
+ object_class.spawn hunt, *arguments, &block
48
39
  else
49
40
  object_class.new *arguments, &block
50
41
  end
@@ -54,7 +45,7 @@ module Scorpion
54
45
  # @param [Scorpion::Object] target to inject.
55
46
  # @return [target]
56
47
  def inject( target )
57
- hunt = Scorpion::Hunt.new self, nil, nil
48
+ hunt = Scorpion::Hunt.new self, nil
58
49
  hunt.inject target
59
50
 
60
51
  target
@@ -64,14 +55,14 @@ module Scorpion
64
55
  # @param [Array<Object>] args to pass to the constructor.
65
56
  # @param [#call] block to pass to the constructor.
66
57
  # @return [Scorpion::Object] the spawned object.
67
- def new( object_class, *arguments, **dependencies, &block )
68
- hunt = Hunt.new( self, object_class, nil, *arguments, **dependencies, &block )
58
+ def new( object_class, *arguments, &block )
59
+ hunt = Hunt.new( self, object_class, *arguments, &block )
69
60
  Scorpion::Dependency::ClassDependency.new( object_class ).fetch( hunt )
70
61
  end
71
62
 
72
63
  # Execute the `hunt` returning the desired dependency.
73
64
  # @param [Hunt] hunt to execute.
74
- # @return [Object] an object that satisfies the hunt contract and traits.
65
+ # @return [Object] an object that satisfies the hunt contract.
75
66
  def execute( hunt )
76
67
  fail "Not implemented"
77
68
  end
@@ -102,6 +93,7 @@ module Scorpion
102
93
  def logger
103
94
  @logger || Scorpion.logger
104
95
  end
96
+
105
97
  def logger=( value )
106
98
  @logger = value
107
99
  end
@@ -125,7 +117,7 @@ module Scorpion
125
117
 
126
118
  def self.instance=( scorpion )
127
119
  if @instance_referenced
128
- logger.warn "Replacing the global Scorpion.instance will not update any Scorpion::Nest instances created with the original scorpion."
120
+ logger.warn "Replacing the global Scorpion.instance will not update any Scorpion::Nest instances created with the original scorpion." # rubocop:disable Metrics/LineLength
129
121
  @instance_referenced = false
130
122
  end
131
123
  @instance = scorpion
@@ -145,17 +137,12 @@ module Scorpion
145
137
  instance.fetch dependencies, &block
146
138
  end
147
139
 
148
- # Hunt for dependency from the primary Scorpion {#instance}.
149
- # @see #fetch_by_traits
150
- def self.fetch_by_traits( dependencies, &block )
151
- instance.fetch_by_traits dependencies, &block
152
- end
153
-
154
140
  # @!attribute logger
155
141
  # @return [Logger] logger for the Scorpion framework to use.
156
142
  def self.logger
157
143
  @logger ||= defined?( ::Rails ) ? ::Rails.logger : Logger.new( STDOUT )
158
144
  end
145
+
159
146
  def self.logger=( value )
160
147
  @logger = value
161
148
  end
@@ -168,8 +155,8 @@ module Scorpion
168
155
 
169
156
  # Used by concrete scorpions to notify the caller that the hunt was
170
157
  # unsuccessful.
171
- def unsuccessful_hunt( contract, traits )
172
- fail UnsuccessfulHunt.new contract, traits
158
+ def unsuccessful_hunt( contract )
159
+ fail UnsuccessfulHunt, contract
173
160
  end
174
161
 
175
162
  end