maintain 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/maintain/value.rb +3 -4
- data/maintain.gemspec +1 -1
- data/spec/integer_spec.rb +10 -0
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.5
|
data/lib/maintain/value.rb
CHANGED
@@ -21,7 +21,6 @@ module Maintain
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def ===(value)
|
24
|
-
raise "#{compare_value} #{compare_value_for(value)}"
|
25
24
|
(compare_value == compare_value_for(value)) || super
|
26
25
|
end
|
27
26
|
|
@@ -92,10 +91,10 @@ module Maintain
|
|
92
91
|
end
|
93
92
|
|
94
93
|
def state_name_for(value)
|
95
|
-
if
|
94
|
+
if value.to_s =~ /^\d+$/
|
95
|
+
@state.state_name_for(value.to_i)
|
96
|
+
elsif (value.is_a?(String) || value.is_a?(Symbol))
|
96
97
|
@state.states.has_key?(value.to_sym) ? value.to_sym : nil
|
97
|
-
else
|
98
|
-
@state.state_name_for(value)
|
99
98
|
end
|
100
99
|
end
|
101
100
|
|
data/maintain.gemspec
CHANGED
data/spec/integer_spec.rb
CHANGED
@@ -18,5 +18,15 @@ describe Maintain do
|
|
18
18
|
end
|
19
19
|
@maintainer = MaintainTest.new
|
20
20
|
end
|
21
|
+
|
22
|
+
it "should return valid names, too" do
|
23
|
+
@maintainer.kind = :woman
|
24
|
+
@maintainer.kind.name.should == "woman"
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should handle numbery strings" do
|
28
|
+
@maintainer.kind = "3"
|
29
|
+
@maintainer.none?.should be_true
|
30
|
+
end
|
21
31
|
end
|
22
32
|
end
|