couch_potato 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
+ :major: 0
2
3
  :minor: 3
3
- :patch: 1
4
+ :patch: 2
4
5
  :build:
5
- :major: 0
@@ -24,9 +24,9 @@ module CouchPotato
24
24
  def cast_native(value, type)
25
25
  if type && !value.instance_of?(type)
26
26
  if type == Fixnum
27
- value.to_s.scan(/\d/).join.to_i unless value.blank?
27
+ value.to_s.scan(/-?\d+/).join.to_i unless value.blank?
28
28
  elsif type == Float
29
- value.to_s.scan(/\d+\.?\d*/).join.to_f unless value.blank?
29
+ value.to_s.scan(/-?\d+\.?\d*/).join.to_f unless value.blank?
30
30
  else
31
31
  type.json_create value unless value.blank?
32
32
  end
@@ -58,6 +58,11 @@ describe "attributes" do
58
58
  @plant.typed_leaf_count.should == 4
59
59
  end
60
60
 
61
+ it "should convert a string into a negative fixnum" do
62
+ @plant.typed_leaf_count = '-4'
63
+ @plant.typed_leaf_count.should == -4
64
+ end
65
+
61
66
  it "should leave a fixnum as is" do
62
67
  @plant.typed_leaf_count = 4
63
68
  @plant.typed_leaf_count.should == 4
@@ -94,6 +99,11 @@ describe "attributes" do
94
99
  @plant.typed_leaf_size = '5'
95
100
  @plant.typed_leaf_size.should == 5.0
96
101
  end
102
+
103
+ it "should convert a negative number in a string" do
104
+ @plant.typed_leaf_size = '-5.0'
105
+ @plant.typed_leaf_size.should == -5.0
106
+ end
97
107
 
98
108
  it "should leave a float as it is" do
99
109
  @plant.typed_leaf_size = 0.5
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: couch_potato
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 3
9
- - 1
10
- version: 0.3.1
8
+ - 2
9
+ version: 0.3.2
11
10
  platform: ruby
12
11
  authors:
13
12
  - Alexander Lang
@@ -15,7 +14,7 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2010-09-23 00:00:00 +02:00
17
+ date: 2010-11-03 00:00:00 +01:00
19
18
  default_executable:
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
@@ -26,7 +25,6 @@ dependencies:
26
25
  requirements:
27
26
  - - ">="
28
27
  - !ruby/object:Gem::Version
29
- hash: 3
30
28
  segments:
31
29
  - 0
32
30
  version: "0"
@@ -40,7 +38,6 @@ dependencies:
40
38
  requirements:
41
39
  - - ">="
42
40
  - !ruby/object:Gem::Version
43
- hash: 21
44
41
  segments:
45
42
  - 1
46
43
  - 0
@@ -56,7 +53,6 @@ dependencies:
56
53
  requirements:
57
54
  - - ">="
58
55
  - !ruby/object:Gem::Version
59
- hash: 3
60
56
  segments:
61
57
  - 0
62
58
  version: "0"
@@ -165,7 +161,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
165
161
  requirements:
166
162
  - - ">="
167
163
  - !ruby/object:Gem::Version
168
- hash: 3
169
164
  segments:
170
165
  - 0
171
166
  version: "0"
@@ -174,7 +169,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
174
169
  requirements:
175
170
  - - ">="
176
171
  - !ruby/object:Gem::Version
177
- hash: 3
178
172
  segments:
179
173
  - 0
180
174
  version: "0"