maintain 0.1.7 → 0.1.8
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/maintain/bitmask_value.rb +5 -0
- data/lib/maintain/value.rb +2 -2
- data/maintain.gemspec +2 -2
- data/spec/active_record_spec.rb +5 -0
- data/spec/integer_spec.rb +5 -5
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.8
|
data/lib/maintain/value.rb
CHANGED
@@ -31,7 +31,7 @@ module Maintain
|
|
31
31
|
|
32
32
|
def initialize(state, value = nil)
|
33
33
|
@state = state
|
34
|
-
@value = value
|
34
|
+
@value = state_name_for(value)
|
35
35
|
end
|
36
36
|
|
37
37
|
def inspect
|
@@ -59,7 +59,7 @@ module Maintain
|
|
59
59
|
@value
|
60
60
|
end
|
61
61
|
|
62
|
-
private
|
62
|
+
# private
|
63
63
|
def compare_value
|
64
64
|
@compare_value ||= compare_value_for(@value)
|
65
65
|
end
|
data/maintain.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{maintain}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.8"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Flip Sasser"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-05-03}
|
13
13
|
s.description = %q{
|
14
14
|
Maintain is a simple state machine mixin for Ruby objects. It supports comparisons, bitmasks,
|
15
15
|
and hooks that really work. It can be used for multiple attributes and will always do its best to
|
data/spec/active_record_spec.rb
CHANGED
@@ -51,6 +51,11 @@ if proceed
|
|
51
51
|
}.should_not raise_error
|
52
52
|
ActiveMaintainTest.first.status.should == 'old'
|
53
53
|
end
|
54
|
+
|
55
|
+
it "should return the correct name when told to" do
|
56
|
+
active_maintain_test = ActiveMaintainTest.create(:status => 'old')
|
57
|
+
ActiveMaintainTest.first.status.name.should == 'old'
|
58
|
+
end
|
54
59
|
end
|
55
60
|
|
56
61
|
describe "named_scopes" do
|
data/spec/integer_spec.rb
CHANGED
@@ -19,14 +19,14 @@ describe Maintain do
|
|
19
19
|
@maintainer = MaintainTest.new
|
20
20
|
end
|
21
21
|
|
22
|
-
it "should return valid names, too" do
|
23
|
-
@maintainer.kind = :woman
|
24
|
-
@maintainer.kind.name.should == "woman"
|
25
|
-
end
|
26
|
-
|
27
22
|
it "should handle numbery strings" do
|
28
23
|
@maintainer.kind = "3"
|
29
24
|
@maintainer.none?.should be_true
|
30
25
|
end
|
26
|
+
|
27
|
+
it "should return valid names, too" do
|
28
|
+
@maintainer.kind = :woman
|
29
|
+
@maintainer.kind.name.should == "woman"
|
30
|
+
end
|
31
31
|
end
|
32
32
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 8
|
9
|
+
version: 0.1.8
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Flip Sasser
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-05-03 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|