sanitizing_bigdecimal 0.0.1 → 0.0.2

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: 603a4f689bc184050db16e47e1fc37d4d3445968
4
- data.tar.gz: 1017ce4c3ae4955374914f71a3a7fb819f032226
3
+ metadata.gz: 119d261442f3f332ae48feeafae126ef1707f500
4
+ data.tar.gz: f2bf4826c9ca085ccf8247e5beb2138474249208
5
5
  SHA512:
6
- metadata.gz: ae281f57bc7145c3c9992796bdcbe467132763f3377935d499a83c797af9eda290cd1f6ee06d38806eb12d0c8648f76d06115c8d19ce3c94731c16e3a9748ee2
7
- data.tar.gz: a9b19bd16af41fda46301444f4c59a34c6d6f50643cc0aba8d767163b90676bf69fff3cbb5672b938be5bd5eeaf87492e231e1cab960ab0c3286393878c37ba1
6
+ metadata.gz: f0ea9dd42abfe4ba5a551dc7917e0bdff3d64d89ec42b2525e368aeb97829aaebb3a46d46763fc6b657c4e69252378a541bb5411c35514ba0a8ec5daa4ea9605
7
+ data.tar.gz: 0c62ec02c34a8f92872eceef45b9da177e3c3f251b2f031e032d9f697903a7026478f4ad98ab92aa034ee986709a4076ba601d4fc07f3e9683d102749b7d34d8
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # SanitizingBigdecimal
1
+ # SanitizingBigDecimal
2
2
 
3
3
  Take user interface into BigDecimal without bugs
4
4
 
@@ -20,7 +20,7 @@ Or install it yourself as:
20
20
 
21
21
  ```ruby
22
22
  user_input = "$3,000.23"
23
- SanitizingBigDecimal.new(user_input)
23
+ SanitizingBigDecimal(user_input)
24
24
  #=> #<BigDecimal:bd78f60,'0.300023E4',9(18)>
25
25
  ```
26
26
 
@@ -1,9 +1,10 @@
1
1
  require 'bigdecimal'
2
2
 
3
3
  class SanitizingBigDecimal
4
- VERSION = "0.0.1"
4
+ VERSION = "0.0.2"
5
5
 
6
6
  def self.get_bigdecimal(input)
7
+ return input if input.is_a?(BigDecimal)
7
8
  BigDecimal(sanitize(input))
8
9
  end
9
10
 
@@ -8,4 +8,9 @@ describe SanitizingBigDecimal do
8
8
  it "strips non-numeric characters (allows decimal point)" do
9
9
  expect(SanitizingBigDecimal("$1,000.23")).to eq(BigDecimal("1000.23"))
10
10
  end
11
+
12
+ it "returns what it's passed, if it is passed a BigDecimal" do
13
+ input = BigDecimal("1000.13")
14
+ expect(SanitizingBigDecimal(input)).to equal(input)
15
+ end
11
16
  end
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.1
4
+ version: 0.0.2
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-10-31 00:00:00.000000000 Z
12
+ date: 2013-11-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -91,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
91
  version: '0'
92
92
  requirements: []
93
93
  rubyforge_project:
94
- rubygems_version: 2.0.3
94
+ rubygems_version: 2.0.2
95
95
  signing_key:
96
96
  specification_version: 4
97
97
  summary: This gem aims to solve various common problems around converting user input