leap 0.3.0 → 0.3.1
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/committee.rb +1 -1
- data/lib/leap/decision.rb +2 -2
- data/lib/leap/deliberation.rb +1 -1
- data/lib/leap/report.rb +4 -2
- data/test/test_leap.rb +1 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.1
|
data/leap.gemspec
CHANGED
data/lib/leap/committee.rb
CHANGED
@@ -11,7 +11,7 @@ module Leap
|
|
11
11
|
quorums.grab do |quorum|
|
12
12
|
next unless quorum.satisfied_by? characteristics
|
13
13
|
if conclusion = quorum.acknowledge(characteristics, considerations.dup)
|
14
|
-
::Leap::Report.new quorum => conclusion
|
14
|
+
::Leap::Report.new self, quorum => conclusion
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
data/lib/leap/decision.rb
CHANGED
@@ -11,8 +11,8 @@ module Leap
|
|
11
11
|
def make(characteristics, *considerations)
|
12
12
|
committees.reverse.inject(Deliberation.new(characteristics)) do |deliberation, committee|
|
13
13
|
if report = committee.report(deliberation.characteristics, considerations)
|
14
|
-
deliberation.reports
|
15
|
-
deliberation.characteristics[committee.name] =
|
14
|
+
deliberation.reports.unshift report
|
15
|
+
deliberation.characteristics[committee.name] = report.conclusion
|
16
16
|
end
|
17
17
|
deliberation
|
18
18
|
end
|
data/lib/leap/deliberation.rb
CHANGED
data/lib/leap/report.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
module Leap
|
2
2
|
class Report
|
3
|
-
attr_reader :conclusion, :quorum
|
3
|
+
attr_reader :committee, :conclusion, :quorum
|
4
4
|
|
5
|
-
def initialize(report)
|
5
|
+
def initialize(committee, report)
|
6
|
+
raise ArgumentError, 'Reports must identify themselves' unless committee.is_a?(::Leap::Committee)
|
7
|
+
@committee = committee
|
6
8
|
raise ArgumentError, 'Please report with quorum => conclusion' unless report.is_a?(Hash) and report.length == 1
|
7
9
|
@quorum, @conclusion = report.first
|
8
10
|
end
|
data/test/test_leap.rb
CHANGED
@@ -23,7 +23,7 @@ class TestLeap < Test::Unit::TestCase
|
|
23
23
|
should 'nevertheless remember how his lucky number was determined' do
|
24
24
|
@person.lucky_number # make the decision
|
25
25
|
assert_equal({ :magic_integer => 6, :lucky_number => 36, :age => 5}, @person.deliberations[:lucky_number].characteristics)
|
26
|
-
assert_equal 'ninja style', @person.deliberations[:lucky_number].reports
|
26
|
+
assert_equal 'ninja style', @person.deliberations[:lucky_number].reports.find{ |r| r.committee.name == :magic_integer }.quorum.name
|
27
27
|
end
|
28
28
|
|
29
29
|
should 'but only as long as it had actually been determined' do
|