leap 0.4.6 → 0.5.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.
- data/.gitignore +1 -0
- data/README.markdown +250 -0
- data/Rakefile +4 -0
- data/leap.gemspec +28 -27
- data/lib/leap.rb +7 -3
- data/lib/leap/committee.rb +46 -20
- data/lib/leap/core_ext.rb +1 -1
- data/lib/leap/decision.rb +27 -4
- data/lib/leap/deliberation.rb +10 -0
- data/lib/leap/deliberations_accessor.rb +16 -0
- data/lib/leap/goal_methods_documentation.rb +20 -0
- data/lib/leap/implicit_attributes.rb +5 -1
- data/lib/leap/no_solution_error.rb +40 -0
- data/lib/leap/quorum.rb +30 -23
- data/lib/leap/report.rb +17 -31
- data/lib/leap/subject.rb +50 -3
- data/lib/leap/version.rb +3 -3
- data/test/helper.rb +20 -3
- data/test/test_leap.rb +50 -10
- metadata +41 -31
- data/README.rdoc +0 -7
- data/lib/leap/xml_serializer.rb +0 -27
- data/test/leap/test_committee.rb +0 -42
- data/test/leap/test_quorum.rb +0 -31
- data/test/leap/test_report.rb +0 -134
metadata
CHANGED
@@ -1,38 +1,39 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: leap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 11
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 5
|
9
|
+
- 0
|
10
|
+
version: 0.5.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Andy Rossmeissl
|
14
14
|
- Seamus Abshere
|
15
|
+
- Derek Kastner
|
15
16
|
autorequire:
|
16
17
|
bindir: bin
|
17
18
|
cert_chain: []
|
18
19
|
|
19
|
-
date: 2011-
|
20
|
+
date: 2011-05-11 00:00:00 -04:00
|
20
21
|
default_executable:
|
21
22
|
dependencies:
|
22
23
|
- !ruby/object:Gem::Dependency
|
23
|
-
name:
|
24
|
+
name: charisma
|
24
25
|
prerelease: false
|
25
26
|
requirement: &id001 !ruby/object:Gem::Requirement
|
26
27
|
none: false
|
27
28
|
requirements:
|
28
|
-
- -
|
29
|
+
- - ~>
|
29
30
|
- !ruby/object:Gem::Version
|
30
|
-
hash:
|
31
|
+
hash: 23
|
31
32
|
segments:
|
32
33
|
- 0
|
34
|
+
- 2
|
33
35
|
- 0
|
34
|
-
|
35
|
-
version: 0.0.11
|
36
|
+
version: 0.2.0
|
36
37
|
type: :development
|
37
38
|
version_requirements: *id001
|
38
39
|
- !ruby/object:Gem::Dependency
|
@@ -50,9 +51,23 @@ dependencies:
|
|
50
51
|
type: :development
|
51
52
|
version_requirements: *id002
|
52
53
|
- !ruby/object:Gem::Dependency
|
53
|
-
name:
|
54
|
+
name: bueller
|
54
55
|
prerelease: false
|
55
56
|
requirement: &id003 !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
hash: 3
|
62
|
+
segments:
|
63
|
+
- 0
|
64
|
+
version: "0"
|
65
|
+
type: :development
|
66
|
+
version_requirements: *id003
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
name: blockenspiel
|
69
|
+
prerelease: false
|
70
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
56
71
|
none: false
|
57
72
|
requirements:
|
58
73
|
- - ">="
|
@@ -64,11 +79,11 @@ dependencies:
|
|
64
79
|
- 2
|
65
80
|
version: 0.3.2
|
66
81
|
type: :runtime
|
67
|
-
version_requirements: *
|
82
|
+
version_requirements: *id004
|
68
83
|
- !ruby/object:Gem::Dependency
|
69
84
|
name: activesupport
|
70
85
|
prerelease: false
|
71
|
-
requirement: &
|
86
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
72
87
|
none: false
|
73
88
|
requirements:
|
74
89
|
- - ">="
|
@@ -80,11 +95,11 @@ dependencies:
|
|
80
95
|
- 4
|
81
96
|
version: 2.3.4
|
82
97
|
type: :runtime
|
83
|
-
version_requirements: *
|
98
|
+
version_requirements: *id005
|
84
99
|
- !ruby/object:Gem::Dependency
|
85
100
|
name: i18n
|
86
101
|
prerelease: false
|
87
|
-
requirement: &
|
102
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
88
103
|
none: false
|
89
104
|
requirements:
|
90
105
|
- - ">="
|
@@ -94,11 +109,11 @@ dependencies:
|
|
94
109
|
- 0
|
95
110
|
version: "0"
|
96
111
|
type: :runtime
|
97
|
-
version_requirements: *
|
112
|
+
version_requirements: *id006
|
98
113
|
- !ruby/object:Gem::Dependency
|
99
114
|
name: builder
|
100
115
|
prerelease: false
|
101
|
-
requirement: &
|
116
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
102
117
|
none: false
|
103
118
|
requirements:
|
104
119
|
- - ">="
|
@@ -108,7 +123,7 @@ dependencies:
|
|
108
123
|
- 0
|
109
124
|
version: "0"
|
110
125
|
type: :runtime
|
111
|
-
version_requirements: *
|
126
|
+
version_requirements: *id007
|
112
127
|
description: Leap to conclusions
|
113
128
|
email: andy@rossmeissl.net
|
114
129
|
executables: []
|
@@ -122,7 +137,7 @@ files:
|
|
122
137
|
- .gitignore
|
123
138
|
- Gemfile
|
124
139
|
- LICENSE
|
125
|
-
- README.
|
140
|
+
- README.markdown
|
126
141
|
- Rakefile
|
127
142
|
- leap.gemspec
|
128
143
|
- lib/leap.rb
|
@@ -130,16 +145,15 @@ files:
|
|
130
145
|
- lib/leap/core_ext.rb
|
131
146
|
- lib/leap/decision.rb
|
132
147
|
- lib/leap/deliberation.rb
|
148
|
+
- lib/leap/deliberations_accessor.rb
|
149
|
+
- lib/leap/goal_methods_documentation.rb
|
133
150
|
- lib/leap/implicit_attributes.rb
|
151
|
+
- lib/leap/no_solution_error.rb
|
134
152
|
- lib/leap/quorum.rb
|
135
153
|
- lib/leap/report.rb
|
136
154
|
- lib/leap/subject.rb
|
137
155
|
- lib/leap/version.rb
|
138
|
-
- lib/leap/xml_serializer.rb
|
139
156
|
- test/helper.rb
|
140
|
-
- test/leap/test_committee.rb
|
141
|
-
- test/leap/test_quorum.rb
|
142
|
-
- test/leap/test_report.rb
|
143
157
|
- test/test_leap.rb
|
144
158
|
has_rdoc: true
|
145
159
|
homepage: http://github.com/rossmeissl/leap
|
@@ -171,13 +185,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
171
185
|
requirements: []
|
172
186
|
|
173
187
|
rubyforge_project:
|
174
|
-
rubygems_version: 1.
|
188
|
+
rubygems_version: 1.6.2
|
175
189
|
signing_key:
|
176
190
|
specification_version: 3
|
177
191
|
summary: A heuristics engine for your Ruby objects
|
178
|
-
test_files:
|
179
|
-
|
180
|
-
- test/leap/test_committee.rb
|
181
|
-
- test/leap/test_quorum.rb
|
182
|
-
- test/leap/test_report.rb
|
183
|
-
- test/test_leap.rb
|
192
|
+
test_files: []
|
193
|
+
|
data/README.rdoc
DELETED
data/lib/leap/xml_serializer.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
require 'builder'
|
2
|
-
require 'active_support/inflector'
|
3
|
-
|
4
|
-
module Leap
|
5
|
-
module XmlSerializer
|
6
|
-
def to_xml(options = {})
|
7
|
-
options[:indent] ||= 2
|
8
|
-
xml = options[:builder] ||= Builder::XmlMarkup.new(options)
|
9
|
-
xml.instruct! unless options[:skip_instruct]
|
10
|
-
yield xml
|
11
|
-
xml
|
12
|
-
end
|
13
|
-
|
14
|
-
def array_to_xml(xml, name, array, singular_name = name.to_s.singularize)
|
15
|
-
xml.__send__ name, :type => 'array' do |subblock|
|
16
|
-
array.each do |item|
|
17
|
-
if item.is_a? Symbol or !item.respond_to?(:to_xml)
|
18
|
-
item = item.to_s if item.is_a?(Symbol)
|
19
|
-
subblock.__send__ singular_name, item, :type => 'string'
|
20
|
-
else
|
21
|
-
item.to_xml(:builder => subblock, :skip_instruct => true)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
data/test/leap/test_committee.rb
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
class Leap::CommitteeTest < Test::Unit::TestCase
|
4
|
-
context 'to_xml' do
|
5
|
-
should 'serialize to xml' do
|
6
|
-
committee = Leap::Committee.new 'Senate Committee on Chocolate Cookies'
|
7
|
-
committee.instance_variable_set :@quorums, [
|
8
|
-
Leap::Quorum.new('with chocolate chips', {}, Proc.new {}),
|
9
|
-
Leap::Quorum.new('with macadamia nuts', {}, Proc.new {})
|
10
|
-
]
|
11
|
-
|
12
|
-
output = ''
|
13
|
-
committee.to_xml(:target => output)
|
14
|
-
assert_equal(<<XML, output)
|
15
|
-
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
16
|
-
<committee>
|
17
|
-
<name type="string">Senate Committee on Chocolate Cookies</name>
|
18
|
-
<quorums type="array">
|
19
|
-
<quorum>
|
20
|
-
<name type="string">with chocolate chips</name>
|
21
|
-
<requirements type="array">
|
22
|
-
</requirements>
|
23
|
-
<appreciates type="array">
|
24
|
-
</appreciates>
|
25
|
-
<complies type="array">
|
26
|
-
</complies>
|
27
|
-
</quorum>
|
28
|
-
<quorum>
|
29
|
-
<name type="string">with macadamia nuts</name>
|
30
|
-
<requirements type="array">
|
31
|
-
</requirements>
|
32
|
-
<appreciates type="array">
|
33
|
-
</appreciates>
|
34
|
-
<complies type="array">
|
35
|
-
</complies>
|
36
|
-
</quorum>
|
37
|
-
</quorums>
|
38
|
-
</committee>
|
39
|
-
XML
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
data/test/leap/test_quorum.rb
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
class Leap::QuorumTest < Test::Unit::TestCase
|
4
|
-
context 'to_xml' do
|
5
|
-
should 'serialize to xml' do
|
6
|
-
quorum = Leap::Quorum.new(
|
7
|
-
'roll call',
|
8
|
-
{ :needs => :count, :complies => :rules_of_endearment, :appreciates => [:adulation, :confirmation] },
|
9
|
-
Proc.new {})
|
10
|
-
|
11
|
-
output = ''
|
12
|
-
quorum.to_xml(:target => output)
|
13
|
-
assert_equal(<<XML, output)
|
14
|
-
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
15
|
-
<quorum>
|
16
|
-
<name type="string">roll call</name>
|
17
|
-
<requirements type="array">
|
18
|
-
<requirement type="string">count</requirement>
|
19
|
-
</requirements>
|
20
|
-
<appreciates type="array">
|
21
|
-
<supplement type="string">adulation</supplement>
|
22
|
-
<supplement type="string">confirmation</supplement>
|
23
|
-
</appreciates>
|
24
|
-
<complies type="array">
|
25
|
-
<compliance type="string">rules_of_endearment</compliance>
|
26
|
-
</complies>
|
27
|
-
</quorum>
|
28
|
-
XML
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
data/test/leap/test_report.rb
DELETED
@@ -1,134 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
class Vagabond
|
4
|
-
include Characterizable
|
5
|
-
|
6
|
-
characterize do
|
7
|
-
has :scruples
|
8
|
-
has :tenacity do
|
9
|
-
displays { |t| "ferocious" }
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
class Leap::ReportTest < Test::Unit::TestCase
|
15
|
-
context 'to_xml' do
|
16
|
-
should 'serialize to xml' do
|
17
|
-
choc = Leap::Quorum.new('with chocolate chips', {}, Proc.new {})
|
18
|
-
mac = Leap::Quorum.new('with macadamia nuts', {}, Proc.new {})
|
19
|
-
committee = Leap::Committee.new :scruples
|
20
|
-
committee.instance_variable_set :@quorums, [choc, mac]
|
21
|
-
|
22
|
-
report = Leap::Report.new Vagabond.new, committee, choc => 'good'
|
23
|
-
|
24
|
-
output = ''
|
25
|
-
report.to_xml(:target => output)
|
26
|
-
assert_equal(<<-XML, output)
|
27
|
-
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
28
|
-
<report>
|
29
|
-
<committee>
|
30
|
-
<name type="string">scruples</name>
|
31
|
-
<quorums type="array">
|
32
|
-
<quorum>
|
33
|
-
<name type="string">with chocolate chips</name>
|
34
|
-
<requirements type="array">
|
35
|
-
</requirements>
|
36
|
-
<appreciates type="array">
|
37
|
-
</appreciates>
|
38
|
-
<complies type="array">
|
39
|
-
</complies>
|
40
|
-
</quorum>
|
41
|
-
<quorum>
|
42
|
-
<name type="string">with macadamia nuts</name>
|
43
|
-
<requirements type="array">
|
44
|
-
</requirements>
|
45
|
-
<appreciates type="array">
|
46
|
-
</appreciates>
|
47
|
-
<complies type="array">
|
48
|
-
</complies>
|
49
|
-
</quorum>
|
50
|
-
</quorums>
|
51
|
-
</committee>
|
52
|
-
<conclusion type="string">good</conclusion>
|
53
|
-
<quorum>
|
54
|
-
<name type="string">with chocolate chips</name>
|
55
|
-
<requirements type="array">
|
56
|
-
</requirements>
|
57
|
-
<appreciates type="array">
|
58
|
-
</appreciates>
|
59
|
-
<complies type="array">
|
60
|
-
</complies>
|
61
|
-
</quorum>
|
62
|
-
</report>
|
63
|
-
XML
|
64
|
-
end
|
65
|
-
should 'use a custom conclusion' do
|
66
|
-
choc = Leap::Quorum.new('with chocolate chips', {}, Proc.new {})
|
67
|
-
mac = Leap::Quorum.new('with macadamia nuts', {}, Proc.new {})
|
68
|
-
committee = Leap::Committee.new :tenacity
|
69
|
-
committee.instance_variable_set :@quorums, [choc, mac]
|
70
|
-
|
71
|
-
report = Leap::Report.new Vagabond.new, committee, choc => 'tough'
|
72
|
-
|
73
|
-
output = ''
|
74
|
-
report.to_xml :target => output
|
75
|
-
assert_equal(<<-XML, output)
|
76
|
-
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
77
|
-
<report>
|
78
|
-
<committee>
|
79
|
-
<name type="string">tenacity</name>
|
80
|
-
<quorums type="array">
|
81
|
-
<quorum>
|
82
|
-
<name type="string">with chocolate chips</name>
|
83
|
-
<requirements type="array">
|
84
|
-
</requirements>
|
85
|
-
<appreciates type="array">
|
86
|
-
</appreciates>
|
87
|
-
<complies type="array">
|
88
|
-
</complies>
|
89
|
-
</quorum>
|
90
|
-
<quorum>
|
91
|
-
<name type="string">with macadamia nuts</name>
|
92
|
-
<requirements type="array">
|
93
|
-
</requirements>
|
94
|
-
<appreciates type="array">
|
95
|
-
</appreciates>
|
96
|
-
<complies type="array">
|
97
|
-
</complies>
|
98
|
-
</quorum>
|
99
|
-
</quorums>
|
100
|
-
</committee>
|
101
|
-
<conclusion type="string">ferocious</conclusion>
|
102
|
-
<quorum>
|
103
|
-
<name type="string">with chocolate chips</name>
|
104
|
-
<requirements type="array">
|
105
|
-
</requirements>
|
106
|
-
<appreciates type="array">
|
107
|
-
</appreciates>
|
108
|
-
<complies type="array">
|
109
|
-
</complies>
|
110
|
-
</quorum>
|
111
|
-
</report>
|
112
|
-
XML
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
context 'formatted_conclusion' do
|
117
|
-
should 'return the regular conclusion if there is no custom format for the conclusion corresponding characteristic' do
|
118
|
-
choc = Leap::Quorum.new('with chocolate chips', {}, Proc.new {})
|
119
|
-
committee = Leap::Committee.new :scruples
|
120
|
-
committee.instance_variable_set :@quorums, [choc]
|
121
|
-
|
122
|
-
report = Leap::Report.new Vagabond.new, committee, choc => 'good'
|
123
|
-
assert_equal 'good', report.formatted_conclusion
|
124
|
-
end
|
125
|
-
should 'return the formatted conclusion if there is a custom format for the conclusion corresponding characteristic' do
|
126
|
-
choc = Leap::Quorum.new('with chocolate chips', {}, Proc.new {})
|
127
|
-
committee = Leap::Committee.new :tenacity
|
128
|
-
committee.instance_variable_set :@quorums, [choc]
|
129
|
-
|
130
|
-
report = Leap::Report.new Vagabond.new, committee, choc => 'good'
|
131
|
-
assert_equal 'ferocious', report.formatted_conclusion
|
132
|
-
end
|
133
|
-
end
|
134
|
-
end
|