gci-class-extensions 1.2.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/gci-class-extensions.rb +4 -0
- data/spec/gci-class-extensions_spec.rb +14 -2
- metadata +34 -13
data/lib/gci-class-extensions.rb
CHANGED
@@ -141,6 +141,19 @@ describe String, "when scrubbing the dollar amounts to only the digits" do
|
|
141
141
|
it "should leave the string alone if has no dollar sign or commas" do
|
142
142
|
"123".scrubbed_dollar_amount.should == "123"
|
143
143
|
end
|
144
|
+
|
145
|
+
it "should convert the string to a dollar with two decimals" do
|
146
|
+
'123.12'.to_dollar_amount.should == 123.12
|
147
|
+
end
|
148
|
+
|
149
|
+
it "should return 0.0 if the string has > 2 decimal places" do
|
150
|
+
'123.1234'.to_dollar_amount.should == 0.0
|
151
|
+
end
|
152
|
+
|
153
|
+
it "should return 0.0 if the string is not a valid $ amount" do
|
154
|
+
"xcv".to_dollar_amount.should == 0.0
|
155
|
+
end
|
156
|
+
|
144
157
|
end
|
145
158
|
|
146
159
|
describe Float, "knowing its value as a percentage" do
|
@@ -157,5 +170,4 @@ describe Float, "knowing its value as a percentage" do
|
|
157
170
|
# when it doesn't round
|
158
171
|
(6.543212).to_percentage(3).should == 654.321
|
159
172
|
end
|
160
|
-
end
|
161
|
-
|
173
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gci-class-extensions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 25
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 2
|
9
|
+
- 3
|
10
|
+
version: 1.2.3
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Patrick Byrne
|
@@ -9,29 +15,37 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date: 2010-
|
18
|
+
date: 2010-08-04 00:00:00 -04:00
|
13
19
|
default_executable:
|
14
20
|
dependencies:
|
15
21
|
- !ruby/object:Gem::Dependency
|
16
22
|
name: activesupport
|
17
|
-
|
18
|
-
|
19
|
-
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
20
26
|
requirements:
|
21
27
|
- - ">="
|
22
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
23
32
|
version: "0"
|
24
|
-
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
25
35
|
- !ruby/object:Gem::Dependency
|
26
36
|
name: valid-date
|
27
|
-
|
28
|
-
|
29
|
-
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
30
40
|
requirements:
|
31
41
|
- - ">="
|
32
42
|
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
44
|
+
segments:
|
45
|
+
- 0
|
33
46
|
version: "0"
|
34
|
-
|
47
|
+
type: :runtime
|
48
|
+
version_requirements: *id002
|
35
49
|
description:
|
36
50
|
email: code@patrickbyrne.net
|
37
51
|
executables: []
|
@@ -43,6 +57,7 @@ extra_rdoc_files:
|
|
43
57
|
files:
|
44
58
|
- lib/gci-class-extensions.rb
|
45
59
|
- README
|
60
|
+
- spec/gci-class-extensions_spec.rb
|
46
61
|
has_rdoc: true
|
47
62
|
homepage: http://bitbucket.org/pbyrne/common-ruby-class-extensions/
|
48
63
|
licenses: []
|
@@ -53,21 +68,27 @@ rdoc_options: []
|
|
53
68
|
require_paths:
|
54
69
|
- lib
|
55
70
|
required_ruby_version: !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
56
72
|
requirements:
|
57
73
|
- - ">="
|
58
74
|
- !ruby/object:Gem::Version
|
75
|
+
hash: 3
|
76
|
+
segments:
|
77
|
+
- 0
|
59
78
|
version: "0"
|
60
|
-
version:
|
61
79
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
|
+
none: false
|
62
81
|
requirements:
|
63
82
|
- - ">="
|
64
83
|
- !ruby/object:Gem::Version
|
84
|
+
hash: 3
|
85
|
+
segments:
|
86
|
+
- 0
|
65
87
|
version: "0"
|
66
|
-
version:
|
67
88
|
requirements: []
|
68
89
|
|
69
90
|
rubyforge_project:
|
70
|
-
rubygems_version: 1.3.
|
91
|
+
rubygems_version: 1.3.7
|
71
92
|
signing_key:
|
72
93
|
specification_version: 3
|
73
94
|
summary: A gem used by our internal team for common class extensions, like not_blank? and not_nil? counterparts to blank? and nil?.
|