sanitizing_bigdecimal 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 119d261442f3f332ae48feeafae126ef1707f500
4
- data.tar.gz: f2bf4826c9ca085ccf8247e5beb2138474249208
3
+ metadata.gz: 856c83b4b24ddaec565ac91dbdd6fb5bcf06bd8d
4
+ data.tar.gz: 27f95ec60d338f2e293d43897c5a304ad80ac6a3
5
5
  SHA512:
6
- metadata.gz: f0ea9dd42abfe4ba5a551dc7917e0bdff3d64d89ec42b2525e368aeb97829aaebb3a46d46763fc6b657c4e69252378a541bb5411c35514ba0a8ec5daa4ea9605
7
- data.tar.gz: 0c62ec02c34a8f92872eceef45b9da177e3c3f251b2f031e032d9f697903a7026478f4ad98ab92aa034ee986709a4076ba601d4fc07f3e9683d102749b7d34d8
6
+ metadata.gz: 7553c432d8251e0c682fec26251ae7fb0a4244983438142f38881e7cb8ae4b96f81994e279824def2b4b91ea4607c26e1551a50024759c44a446224c239f6921
7
+ data.tar.gz: 3002eb0555602d7642ad33c8c0ac054f572006eac6db38636bd127a6db1eebd4cb4c20a9105d1be16a65ec1a5fbcb29e3b1d28d691aae65a5277351e1999d32d
@@ -1,7 +1,7 @@
1
1
  require 'bigdecimal'
2
2
 
3
3
  class SanitizingBigDecimal
4
- VERSION = "0.0.2"
4
+ VERSION = "0.0.3"
5
5
 
6
6
  def self.get_bigdecimal(input)
7
7
  return input if input.is_a?(BigDecimal)
@@ -9,6 +9,7 @@ class SanitizingBigDecimal
9
9
  end
10
10
 
11
11
  def self.sanitize(input)
12
+ return nil.to_s if input.nil?
12
13
  input.gsub(/[^.0-9]/, '')
13
14
  end
14
15
  end
@@ -9,6 +9,10 @@ describe SanitizingBigDecimal do
9
9
  expect(SanitizingBigDecimal("$1,000.23")).to eq(BigDecimal("1000.23"))
10
10
  end
11
11
 
12
+ it "should not blow up with nil" do
13
+ expect{SanitizingBigDecimal(nil)}.to_not raise_error
14
+ end
15
+
12
16
  it "returns what it's passed, if it is passed a BigDecimal" do
13
17
  input = BigDecimal("1000.13")
14
18
  expect(SanitizingBigDecimal(input)).to equal(input)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sanitizing_bigdecimal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Adams
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-05 00:00:00.000000000 Z
12
+ date: 2014-04-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler