dohutil 0.2.22 → 0.2.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dohutil/core_ext/bigdecimal.rb +2 -2
- data/lib/dohutil/current_date.rb +4 -0
- data/test/core_ext/bigdecimal.dt.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 918b2aecbcda649a901f0adb7abd3760c6dcae86
|
4
|
+
data.tar.gz: c89ad4ae8fd1baa1ef97d336ed8d3f6e9d034bd6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5ce1e3175b00e54f2a4ba26e869fdd76ad759a382962057976ab1d84455970b8d5c3f2e1806b298c28af6858e13a475b55b4c9dfb29d1355349e8f401d9d874
|
7
|
+
data.tar.gz: 8b8e3e219a39b0a74153a441748d88227668a6d615af86dc77a60c82db62a0d869806864cedd020a1d2afe46772d9f70c4c55079db92e39790a3894e7c04daaa
|
@@ -4,7 +4,7 @@ require 'bigdecimal/util'
|
|
4
4
|
class Integer
|
5
5
|
unless method_defined?(:to_d)
|
6
6
|
def to_d
|
7
|
-
|
7
|
+
BigDecimal(self)
|
8
8
|
end
|
9
9
|
end
|
10
10
|
end
|
@@ -41,7 +41,7 @@ class BigDecimal
|
|
41
41
|
end
|
42
42
|
|
43
43
|
class NilClass
|
44
|
-
NIL_ZERO_BIGD = BigDecimal(
|
44
|
+
NIL_ZERO_BIGD = BigDecimal(0)
|
45
45
|
|
46
46
|
def to_d
|
47
47
|
NIL_ZERO_BIGD
|
data/lib/dohutil/current_date.rb
CHANGED
@@ -28,6 +28,10 @@ def clear_current_date
|
|
28
28
|
@current_date_stack.clear
|
29
29
|
end
|
30
30
|
|
31
|
+
def current_date_stack
|
32
|
+
@current_date_stack
|
33
|
+
end
|
34
|
+
|
31
35
|
def date_as_start_of_day(date_obj, &block)
|
32
36
|
date_as(DateTime.new(date_obj.year, date_obj.month, date_obj.day, 0, 0, 0), &block)
|
33
37
|
end
|
@@ -3,6 +3,10 @@ require 'dohutil/core_ext/bigdecimal'
|
|
3
3
|
module Doh
|
4
4
|
|
5
5
|
class Test_core_ext_bigdecimal < DohTest::TestGroup
|
6
|
+
def test_integer_to_d
|
7
|
+
assert_equal(BigDecimal(1), 1.to_d)
|
8
|
+
end
|
9
|
+
|
6
10
|
def test_to_dig_valid
|
7
11
|
assert_equal('0.00', BigDecimal('0').to_dig)
|
8
12
|
assert_equal('1.00', BigDecimal('1').to_dig)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dohutil
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Makani Mason
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-02-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: dohroot
|