spook_and_puff_money 0.5.9 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/spook_and_puff/money.rb +10 -9
- metadata +9 -17
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8b7f7e9bfc4ffee280337d6309abce98ccd327fb
|
4
|
+
data.tar.gz: 2d6c025bee927b2895a52fc2d8032e0628da1386
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7b01975af242fb5a9b71dd5d2611e4ee6c2cda1e419d58fa6c45e7e7626868890ad10ecfbf547c6ce7927001c4c134651f3ead012249a2925171fc3987e99c47
|
7
|
+
data.tar.gz: 6976e42b71c5cf6ec58f51b411cbba07804ad780e6b2c649441e39718514d9e35e1c3a500ba9842688b0915db94f8c329ef1b342bad3770d236b852308563414
|
data/lib/spook_and_puff/money.rb
CHANGED
@@ -2,7 +2,7 @@ require 'bigdecimal'
|
|
2
2
|
|
3
3
|
# The main Spook and Puff module which namespaces our projects. Yay?
|
4
4
|
module SpookAndPuff
|
5
|
-
# The money class represents monetary values with a precision of up to seven
|
5
|
+
# The money class represents monetary values with a precision of up to seven
|
6
6
|
# digits. When used as part of a comparison or mathmatical operation it
|
7
7
|
# always ensures the other operand is coerced into a BigDecimal. This ensures
|
8
8
|
# the precision is maintained.
|
@@ -40,10 +40,11 @@ module SpookAndPuff
|
|
40
40
|
# @param [Money, Numeric, String] other
|
41
41
|
#
|
42
42
|
# @return Money
|
43
|
-
#
|
44
|
-
# @raise ArgumentError
|
45
43
|
def ==(other)
|
46
|
-
|
44
|
+
case other
|
45
|
+
when Money then @raw == other.raw
|
46
|
+
else false
|
47
|
+
end
|
47
48
|
end
|
48
49
|
|
49
50
|
# @param [Money, Numeric, String] other
|
@@ -185,7 +186,7 @@ module SpookAndPuff
|
|
185
186
|
end
|
186
187
|
|
187
188
|
# Rounds to the specified places; defaults to two.
|
188
|
-
#
|
189
|
+
#
|
189
190
|
# @param Integer places
|
190
191
|
#
|
191
192
|
# @return Money
|
@@ -193,7 +194,7 @@ module SpookAndPuff
|
|
193
194
|
Money.new(@raw.round(places))
|
194
195
|
end
|
195
196
|
|
196
|
-
# Returns a currency formatted string, set to two decimal places.
|
197
|
+
# Returns a currency formatted string, set to two decimal places.
|
197
198
|
#
|
198
199
|
# @param Hash opts
|
199
200
|
# @option opts [true, false] :prefix
|
@@ -208,7 +209,7 @@ module SpookAndPuff
|
|
208
209
|
|
209
210
|
private
|
210
211
|
|
211
|
-
# Grabs the raw value of a Money instance, erroring with a message
|
212
|
+
# Grabs the raw value of a Money instance, erroring with a message
|
212
213
|
# about comparison if it's the wrong type.
|
213
214
|
#
|
214
215
|
# @param SpookAndPuff::Money other
|
@@ -224,7 +225,7 @@ module SpookAndPuff
|
|
224
225
|
other.raw
|
225
226
|
end
|
226
227
|
|
227
|
-
# Grabs the raw value of a Money instance, erroring with a message
|
228
|
+
# Grabs the raw value of a Money instance, erroring with a message
|
228
229
|
# about comparison if it's the wrong type.
|
229
230
|
#
|
230
231
|
# @param SpookAndPuff::Money other
|
@@ -241,7 +242,7 @@ module SpookAndPuff
|
|
241
242
|
other.raw
|
242
243
|
end
|
243
244
|
|
244
|
-
# Coerces the provided value into a BigDecimal. It will handle any
|
245
|
+
# Coerces the provided value into a BigDecimal. It will handle any
|
245
246
|
# Numeric or string.
|
246
247
|
#
|
247
248
|
# @param [Numeric, String] other
|
metadata
CHANGED
@@ -1,8 +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
|
-
prerelease:
|
4
|
+
version: 1.0.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Luke Sutton
|
@@ -10,12 +9,11 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date:
|
12
|
+
date: 2016-09-07 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: rspec
|
17
16
|
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
17
|
requirements:
|
20
18
|
- - '='
|
21
19
|
- !ruby/object:Gem::Version
|
@@ -23,7 +21,6 @@ dependencies:
|
|
23
21
|
type: :development
|
24
22
|
prerelease: false
|
25
23
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
24
|
requirements:
|
28
25
|
- - '='
|
29
26
|
- !ruby/object:Gem::Version
|
@@ -31,7 +28,6 @@ dependencies:
|
|
31
28
|
- !ruby/object:Gem::Dependency
|
32
29
|
name: yard
|
33
30
|
requirement: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
31
|
requirements:
|
36
32
|
- - '='
|
37
33
|
- !ruby/object:Gem::Version
|
@@ -39,7 +35,6 @@ dependencies:
|
|
39
35
|
type: :development
|
40
36
|
prerelease: false
|
41
37
|
version_requirements: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
38
|
requirements:
|
44
39
|
- - '='
|
45
40
|
- !ruby/object:Gem::Version
|
@@ -47,7 +42,6 @@ dependencies:
|
|
47
42
|
- !ruby/object:Gem::Dependency
|
48
43
|
name: redcarpet
|
49
44
|
requirement: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
45
|
requirements:
|
52
46
|
- - '='
|
53
47
|
- !ruby/object:Gem::Version
|
@@ -55,7 +49,6 @@ dependencies:
|
|
55
49
|
type: :development
|
56
50
|
prerelease: false
|
57
51
|
version_requirements: !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
59
52
|
requirements:
|
60
53
|
- - '='
|
61
54
|
- !ruby/object:Gem::Version
|
@@ -67,33 +60,32 @@ executables: []
|
|
67
60
|
extensions: []
|
68
61
|
extra_rdoc_files: []
|
69
62
|
files:
|
70
|
-
- lib/spook_and_puff/money.rb
|
71
|
-
- lib/spook_and_puff/money_attributes.rb
|
72
63
|
- MIT-LICENSE
|
73
64
|
- README.md
|
65
|
+
- lib/spook_and_puff/money.rb
|
66
|
+
- lib/spook_and_puff/money_attributes.rb
|
74
67
|
homepage: http://spookandpuff.com
|
75
68
|
licenses: []
|
69
|
+
metadata: {}
|
76
70
|
post_install_message:
|
77
71
|
rdoc_options: []
|
78
72
|
require_paths:
|
79
73
|
- lib
|
80
74
|
required_ruby_version: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
75
|
requirements:
|
83
|
-
- -
|
76
|
+
- - ">="
|
84
77
|
- !ruby/object:Gem::Version
|
85
78
|
version: '0'
|
86
79
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
-
none: false
|
88
80
|
requirements:
|
89
|
-
- -
|
81
|
+
- - ">="
|
90
82
|
- !ruby/object:Gem::Version
|
91
83
|
version: '0'
|
92
84
|
requirements: []
|
93
85
|
rubyforge_project:
|
94
|
-
rubygems_version:
|
86
|
+
rubygems_version: 2.2.2
|
95
87
|
signing_key:
|
96
|
-
specification_version:
|
88
|
+
specification_version: 4
|
97
89
|
summary: A simple money class.
|
98
90
|
test_files: []
|
99
91
|
has_rdoc:
|