leap 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/leap.gemspec +1 -1
- data/lib/leap/decision.rb +2 -2
- data/lib/leap/subject.rb +3 -1
- data/test/test_leap.rb +9 -0
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.5
|
data/leap.gemspec
CHANGED
data/lib/leap/decision.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Leap
|
2
2
|
class Decision
|
3
|
-
attr_reader :goal, :signature_method, :committees
|
3
|
+
attr_reader :goal, :signature_method, :committees, :minutes
|
4
4
|
|
5
5
|
def initialize(goal, options)
|
6
6
|
@goal = goal
|
@@ -14,7 +14,7 @@ module Leap
|
|
14
14
|
characteristics[committee.name] = report
|
15
15
|
end
|
16
16
|
characteristics
|
17
|
-
end
|
17
|
+
end
|
18
18
|
end
|
19
19
|
|
20
20
|
include ::Blockenspiel::DSL
|
data/lib/leap/subject.rb
CHANGED
@@ -2,13 +2,15 @@ module Leap
|
|
2
2
|
module Subject
|
3
3
|
def self.extended(base)
|
4
4
|
base.instance_variable_set :@decisions, {}
|
5
|
+
base.send :attr_reader, :minutes
|
5
6
|
end
|
6
7
|
attr_reader :decisions
|
7
8
|
def decide(goal, options = {}, &blk)
|
8
9
|
decisions[goal] = ::Leap::Decision.new goal, options
|
9
10
|
Blockenspiel.invoke(blk, decisions[goal])
|
10
11
|
define_method goal do |*considerations|
|
11
|
-
self.class.decisions[goal].make
|
12
|
+
@minutes = self.class.decisions[goal].make(send(self.class.decisions[goal].signature_method), *considerations)
|
13
|
+
@minutes[goal]
|
12
14
|
end
|
13
15
|
end
|
14
16
|
end
|
data/test/test_leap.rb
CHANGED
@@ -19,6 +19,15 @@ class TestLeap < Test::Unit::TestCase
|
|
19
19
|
should 'indeed have a lucky number' do
|
20
20
|
assert_equal 36, @person.lucky_number
|
21
21
|
end
|
22
|
+
|
23
|
+
should 'nevertheless remember how his lucky number was determined' do
|
24
|
+
@person.lucky_number # make the decision
|
25
|
+
assert_equal({ :magic_integer => 6, :lucky_number => 36, :age => 5}, @person.minutes)
|
26
|
+
end
|
27
|
+
|
28
|
+
should 'but only as long as it had actually been determined' do
|
29
|
+
assert_nil @person.minutes
|
30
|
+
end
|
22
31
|
end
|
23
32
|
|
24
33
|
context "A generic place" do
|