scorpion-ioc 0.2.0 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e60f46d66df09f4c6f7615fd2710d4fe3527c965
4
- data.tar.gz: 57c9523e72aa665056649295c6453c7ce255b724
3
+ metadata.gz: c95b03306b50c7e49688d4736c3287ec3ebab9d0
4
+ data.tar.gz: 6011ea65e623df92f421ad2037ca3a6aa02e0a0c
5
5
  SHA512:
6
- metadata.gz: 09b2275087d17e93753be0d51c44306b8dc3c18586ab7120821eb5aac16fbdb82b1a9df4ae5a2c67bdb411fe4ea6c629524fdbc2b5bdfd3fdb2d2401552989aa
7
- data.tar.gz: 6188ca0ac77ef49985acf0e5d044eec89210d243479ade15d63d6f51289b273ceab9c4ca5f5fe5969353f79082a9d4e4b913341ff8e3c3f04adb1c723d750703
6
+ metadata.gz: c3de90e129024ce65ee4591d49e821877d0854c8c0f6abebf85f6237cb4558cc905bf9961ae59530fb10884c0f890f33ccb733fe802afb01245417c761d52118
7
+ data.tar.gz: b9f9feb46528c3f66ab2a4c835bb88b309b0e6f017bf138ef841633a5e71b3e141a6476a170181f26590fc9914162de976cbf3ff5cf784c6aabf2adfe087028b
@@ -31,8 +31,8 @@ module Scorpion
31
31
 
32
32
  def initialize( scorpion )
33
33
  @scorpion = scorpion
34
- @prey_set = @active_prey_set = Set.new
35
- @shared_prey_set = Set.new
34
+ @prey_set = @active_prey_set = []
35
+ @shared_prey_set = []
36
36
  end
37
37
 
38
38
  # Find {Prey} that matches the requested `contract` and `traits`.
@@ -66,7 +66,7 @@ module Scorpion
66
66
  # @param [Array<Symbol>] traits found on the {Prey}.
67
67
  # @return [Scorpion::Prey] the prey to be hunted for.
68
68
  def hunt_for( contract, traits = nil, &builder )
69
- active_prey_set << prey_class( contract, &builder ).new( contract, traits, &builder )
69
+ active_prey_set.unshift prey_class( contract, &builder ).new( contract, traits, &builder )
70
70
  end
71
71
  alias_method :offer, :hunt_for
72
72
 
@@ -74,7 +74,7 @@ module Scorpion
74
74
  # for the resource.
75
75
  # @see #hunt_for
76
76
  def capture( contract, traits = nil, &builder )
77
- active_prey_set << Scorpion::Prey::CapturedPrey.new( prey_class( contract, &builder ).new( contract, traits, &builder ) )
77
+ active_prey_set.unshift Scorpion::Prey::CapturedPrey.new( prey_class( contract, &builder ).new( contract, traits, &builder ) )
78
78
  end
79
79
  alias_method :singleton, :capture
80
80
 
@@ -1,5 +1,5 @@
1
1
  module Scorpion
2
- VERSION_NUMBER = "0.2.0"
2
+ VERSION_NUMBER = "0.3.0"
3
3
  VERSION_SUFFIX = ""
4
4
  VERSION = "#{VERSION_NUMBER}#{VERSION_SUFFIX}"
5
5
  end
@@ -28,23 +28,24 @@ describe Scorpion::Hunter do
28
28
 
29
29
  let( :hunter ) do
30
30
  Scorpion::Hunter.new do
31
+ capture Test::Hunter::Lion, :tame
32
+
31
33
  hunt_for Test::Hunter::Bear
32
34
  hunt_for Test::Hunter::Lion, :male
33
35
  hunt_for Test::Hunter::Grizly, :female
34
36
  hunt_for Test::Hunter::Argumented
35
37
 
36
- capture Test::Hunter::Lion, :tame
37
38
  hunt_for Test::Hunter::Zoo
38
39
  end
39
40
  end
40
41
 
41
42
  it "spawns prey" do
42
- expect( hunter.hunt Test::Hunter::Beast ).to be_a Test::Hunter::Bear
43
+ expect( hunter.hunt Test::Hunter::Beast ).to be_a Test::Hunter::Beast
43
44
  end
44
45
 
45
46
  it "spawns a new instance for multiple requests" do
46
47
  first = hunter.hunt Test::Hunter::Beast
47
- expect( hunter.hunt Test::Hunter::Beast ).not_to eq first
48
+ expect( hunter.hunt Test::Hunter::Beast ).not_to be first
48
49
  end
49
50
 
50
51
  it "spawns the same instance for captured prey" do
@@ -54,15 +54,15 @@ describe Scorpion::HuntingMap do
54
54
  end
55
55
  end
56
56
 
57
- it "returns the first prey that matches one trait" do
58
- expect( map.find( Test::HuntingMap::Weapon, :one_handed ).traits ).to include :sharp
57
+ it "returns the last prey that matches one trait" do
58
+ expect( map.find( Test::HuntingMap::Weapon, :one_handed ).traits ).to include :blunt
59
59
  end
60
60
 
61
- it "returns the first prey that matches all of the traits" do
61
+ it "returns the last prey that matches all of the traits" do
62
62
  expect( map.find( Test::HuntingMap::Weapon, [ :one_handed, :blunt ] ).traits ).to include :blunt
63
63
  end
64
64
 
65
- it "returns the first prey that matches a unique trait" do
65
+ it "returns the last prey that matches a unique trait" do
66
66
  expect( map.find( Test::HuntingMap::Weapon, :blunt ).traits ).to include :blunt
67
67
  end
68
68
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scorpion-ioc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Alexander
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-18 00:00:00.000000000 Z
11
+ date: 2015-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails