spook_and_puff_money 0.5.6 → 0.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/spook_and_puff/money.rb +9 -2
- metadata +2 -2
data/lib/spook_and_puff/money.rb
CHANGED
@@ -22,12 +22,19 @@ module SpookAndPuff
|
|
22
22
|
def initialize(value)
|
23
23
|
@raw = case value
|
24
24
|
when SpookAndPuff::Money then value.raw
|
25
|
-
when BigDecimal then value
|
26
|
-
when String then BigDecimal.new(value.gsub(/\$/, ''))
|
25
|
+
when BigDecimal then value
|
26
|
+
when String then BigDecimal.new(value.gsub(/\$/, ''))
|
27
27
|
else raise TypeError.new("Money can only be initalized with a BigDecimal or String not #{value.class}.")
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
+
# A convenience method which returns an instance initalized to zero.
|
32
|
+
#
|
33
|
+
# @return SpookAndPuff::Money
|
34
|
+
def self.zero
|
35
|
+
new("0")
|
36
|
+
end
|
37
|
+
|
31
38
|
# Value comparison.
|
32
39
|
#
|
33
40
|
# @param [Money, Numeric, String] other
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spook_and_puff_money
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-09-09 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|