progression 0.0.2 → 0.0.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/VERSION +1 -1
- data/lib/progression.rb +22 -0
- data/progression.gemspec +4 -4
- data/spec/progression_spec.rb +20 -0
- metadata +11 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
data/lib/progression.rb
CHANGED
@@ -73,6 +73,12 @@ module Progression
|
|
73
73
|
!step.evaluate(@object)
|
74
74
|
end
|
75
75
|
end
|
76
|
+
|
77
|
+
def percentage_completed_after_next_step
|
78
|
+
return 100.0 if next_step.nil?
|
79
|
+
percentage_completed + @progression.percentage_value_for(next_step)
|
80
|
+
end
|
81
|
+
|
76
82
|
end
|
77
83
|
|
78
84
|
class Step
|
@@ -90,3 +96,19 @@ module Progression
|
|
90
96
|
end
|
91
97
|
|
92
98
|
end
|
99
|
+
|
100
|
+
class NilClass
|
101
|
+
|
102
|
+
def blank?
|
103
|
+
true
|
104
|
+
end unless method_defined?(:blank?)
|
105
|
+
|
106
|
+
end
|
107
|
+
|
108
|
+
class String
|
109
|
+
|
110
|
+
def blank?
|
111
|
+
self !~ /\S/
|
112
|
+
end unless method_defined?(:blank?)
|
113
|
+
|
114
|
+
end
|
data/progression.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{progression}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Michael Guterl"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-06-09}
|
13
13
|
s.description = %q{progression provides a set of simple utility classes and a DSL for
|
14
14
|
measuring an objects progress through a progression of steps. This is
|
15
15
|
especially useful for defining and calculating profile completion
|
@@ -41,7 +41,7 @@ either coupled with ActiveRecord or ActionController in some way.
|
|
41
41
|
s.homepage = %q{http://github.com/mguterl/progression}
|
42
42
|
s.rdoc_options = ["--charset=UTF-8"]
|
43
43
|
s.require_paths = ["lib"]
|
44
|
-
s.rubygems_version = %q{1.3.
|
44
|
+
s.rubygems_version = %q{1.3.7}
|
45
45
|
s.summary = %q{progression provides a set of simple utility classes and a DSL for measuring an objects progress through a progression of steps}
|
46
46
|
s.test_files = [
|
47
47
|
"spec/progression_spec.rb",
|
@@ -52,7 +52,7 @@ either coupled with ActiveRecord or ActionController in some way.
|
|
52
52
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
53
53
|
s.specification_version = 3
|
54
54
|
|
55
|
-
if Gem::Version.new(Gem::
|
55
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
56
56
|
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
57
57
|
else
|
58
58
|
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
data/spec/progression_spec.rb
CHANGED
@@ -67,6 +67,10 @@ describe "Progression" do
|
|
67
67
|
@progression.next_step.name.should == :step_1
|
68
68
|
end
|
69
69
|
|
70
|
+
it 'should return the percentage completed after the next step is completed' do
|
71
|
+
@progression.percentage_completed_after_next_step.should == 50.0
|
72
|
+
end
|
73
|
+
|
70
74
|
describe "after first step" do
|
71
75
|
|
72
76
|
before do
|
@@ -86,6 +90,10 @@ describe "Progression" do
|
|
86
90
|
@progression.next_step.name.should == :step_2
|
87
91
|
end
|
88
92
|
|
93
|
+
it 'should return the percentage completed after the next step is completed' do
|
94
|
+
@progression.percentage_completed_after_next_step.should == 100.0
|
95
|
+
end
|
96
|
+
|
89
97
|
describe "and second step" do
|
90
98
|
|
91
99
|
before do
|
@@ -105,6 +113,10 @@ describe "Progression" do
|
|
105
113
|
@progression.next_step.should == nil
|
106
114
|
end
|
107
115
|
|
116
|
+
it 'should return the percentage completed after the next step is completed' do
|
117
|
+
@progression.percentage_completed_after_next_step.should == 100.0
|
118
|
+
end
|
119
|
+
|
108
120
|
end
|
109
121
|
|
110
122
|
end
|
@@ -132,6 +144,10 @@ describe "Progression" do
|
|
132
144
|
@progression.next_step.name.should == :step_1
|
133
145
|
end
|
134
146
|
|
147
|
+
it 'should return the percentage completed after the next step is completed' do
|
148
|
+
@progression.percentage_completed_after_next_step.should == 25.0
|
149
|
+
end
|
150
|
+
|
135
151
|
describe "after last step" do
|
136
152
|
|
137
153
|
before do
|
@@ -150,6 +166,10 @@ describe "Progression" do
|
|
150
166
|
@progression.next_step.name.should == :step_1
|
151
167
|
end
|
152
168
|
|
169
|
+
it 'should return the percentage completed after the next step is completed' do
|
170
|
+
@progression.percentage_completed_after_next_step.should == 75.0
|
171
|
+
end
|
172
|
+
|
153
173
|
end
|
154
174
|
|
155
175
|
end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: progression
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 25
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Michael Guterl
|
@@ -14,16 +15,18 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-
|
18
|
+
date: 2010-06-09 00:00:00 -04:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: rspec
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ">="
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 13
|
27
30
|
segments:
|
28
31
|
- 1
|
29
32
|
- 2
|
@@ -72,23 +75,27 @@ rdoc_options:
|
|
72
75
|
require_paths:
|
73
76
|
- lib
|
74
77
|
required_ruby_version: !ruby/object:Gem::Requirement
|
78
|
+
none: false
|
75
79
|
requirements:
|
76
80
|
- - ">="
|
77
81
|
- !ruby/object:Gem::Version
|
82
|
+
hash: 3
|
78
83
|
segments:
|
79
84
|
- 0
|
80
85
|
version: "0"
|
81
86
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
none: false
|
82
88
|
requirements:
|
83
89
|
- - ">="
|
84
90
|
- !ruby/object:Gem::Version
|
91
|
+
hash: 3
|
85
92
|
segments:
|
86
93
|
- 0
|
87
94
|
version: "0"
|
88
95
|
requirements: []
|
89
96
|
|
90
97
|
rubyforge_project:
|
91
|
-
rubygems_version: 1.3.
|
98
|
+
rubygems_version: 1.3.7
|
92
99
|
signing_key:
|
93
100
|
specification_version: 3
|
94
101
|
summary: progression provides a set of simple utility classes and a DSL for measuring an objects progress through a progression of steps
|