leap 0.5.2 → 0.5.3
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.
- data/lib/leap/committee.rb +6 -1
- data/lib/leap/decision.rb +3 -2
- data/lib/leap/version.rb +1 -1
- data/test/test_leap.rb +16 -0
- metadata +4 -4
data/lib/leap/committee.rb
CHANGED
@@ -18,14 +18,19 @@ module Leap
|
|
18
18
|
# The array of quorums defined within the committee.
|
19
19
|
attr_reader :quorums
|
20
20
|
|
21
|
+
# An options hash
|
22
|
+
attr_reader :options
|
23
|
+
|
21
24
|
# Creates a new <tt>Leap::Committee</tt> with the given name.
|
22
25
|
#
|
23
26
|
# Generally you don't create these objects directly; <tt>Leap::Decision#committee</tt> does that for you.
|
24
27
|
#
|
25
28
|
# @see Leap::Decision#committee
|
26
29
|
# @param [Symbol] name The name of the committee, traditionally formulated to represent a computable attribute of the subject.
|
27
|
-
|
30
|
+
# @param [Hash] options Any options you wish the committee to remember (for third-party use).
|
31
|
+
def initialize(name, options)
|
28
32
|
@name = name
|
33
|
+
@options = options
|
29
34
|
@quorums = []
|
30
35
|
end
|
31
36
|
|
data/lib/leap/decision.rb
CHANGED
@@ -44,8 +44,9 @@ module Leap
|
|
44
44
|
#
|
45
45
|
# Used within a <tt>Leap::Subject#decide</tt> block to define a new committee. See <tt>Leap::Committee</tt> for details.
|
46
46
|
# @param [Symbol] name The name of the attribute that the committee will return.
|
47
|
-
|
48
|
-
|
47
|
+
# @param [Hash, optional] options Any options you wish the committee to remember (for third-party use).
|
48
|
+
def committee(name, options = {}, &blk)
|
49
|
+
committee = ::Leap::Committee.new(name, options)
|
49
50
|
@committees << committee
|
50
51
|
::Blockenspiel.invoke blk, committee
|
51
52
|
end
|
data/lib/leap/version.rb
CHANGED
data/test/test_leap.rb
CHANGED
@@ -141,4 +141,20 @@ class TestLeap < Test::Unit::TestCase
|
|
141
141
|
end
|
142
142
|
end
|
143
143
|
end
|
144
|
+
|
145
|
+
context 'A committee' do
|
146
|
+
setup do
|
147
|
+
class Owl
|
148
|
+
include Leap
|
149
|
+
decide :eye_size do
|
150
|
+
committee :eye_size, :measures => :length do
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
should 'remember options that it was given when it was created' do
|
157
|
+
assert_equal :length, Owl.decisions[:eye_size].committees.first.options[:measures]
|
158
|
+
end
|
159
|
+
end
|
144
160
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: leap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 13
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
9
|
+
- 3
|
10
|
+
version: 0.5.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Andy Rossmeissl
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2011-05-
|
20
|
+
date: 2011-05-25 00:00:00 -04:00
|
21
21
|
default_executable:
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|