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 CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.3.1
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{leap}
8
- s.version = "0.3.0"
8
+ s.version = "0.3.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Andy Rossmeissl", "Seamus Abshere"]
@@ -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
@@ -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[committee.name] = report
15
- deliberation.characteristics[committee.name] = deliberation.reports[committee.name].conclusion
14
+ deliberation.reports.unshift report
15
+ deliberation.characteristics[committee.name] = report.conclusion
16
16
  end
17
17
  deliberation
18
18
  end
@@ -5,7 +5,7 @@ module Leap
5
5
 
6
6
  def initialize(characteristics)
7
7
  self.characteristics = characteristics
8
- self.reports = {}
8
+ self.reports = []
9
9
  end
10
10
 
11
11
  def [](characteristic)
@@ -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
@@ -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[:magic_integer].quorum.name
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
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 0
9
- version: 0.3.0
8
+ - 1
9
+ version: 0.3.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Andy Rossmeissl