cashify 0.9.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +0 -9
- data/lib/cashify/arithmetic.rb +4 -0
- data/lib/cashify/version.rb +1 -1
- data/lib/cashify.rb +0 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf06dc249f2461c5e6f7f59cdf2208eae3a423007570b12e5a52eaa8ed5ca44c
|
4
|
+
data.tar.gz: 625e22c82feb306c2564f5f7e79db25d6d658bfddaa347450b909bb7503b2fae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f65af840ef4a53e2bf82bff63197526bbbfa22d936321b57ddabce52762fb02f7f55bfd3436306fd6af99bdd0882dfead0b5a323b613ff4b0c6bbae4d5bc032
|
7
|
+
data.tar.gz: 84c82bca4217c8a116c24a62cde33d9d0f12c6d2139f357ebb64633f7472f2c56bb566b89ae0e0094c0029bfe233655f25261c22a70ea7ee74776ef406efa3ea
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -161,15 +161,6 @@ Cash.new(EUR: 100_00, SEK: 100_00, USD: 100_00).to_s
|
|
161
161
|
# "100 EUR, 100 SEK, 100 USD"
|
162
162
|
```
|
163
163
|
|
164
|
-
#### `.sum`
|
165
|
-
|
166
|
-
You'll be working with arrays of Cash objects a lot. You should absolutely be using Ruby's excellent array methods on them, but unfortunately `cash_array.sum` won't work. Ruby's `sum` method injects a `0` as the first value, and even though `Cash.new(USD: 100) + 0` is super valid and nice, `0 + Cash.new(USD: 100)` will try to coerce your Cash object into an integer which just won't work. So if you want to sum an array of Cash, you can instead use:
|
167
|
-
|
168
|
-
```ruby
|
169
|
-
Cash.sum [Cash.new(EUR: 100_00), Cash.new(SEK: 100_00), Cash.new(EUR: 100_00)]
|
170
|
-
# 200 EUR, 100 SEK
|
171
|
-
```
|
172
|
-
|
173
164
|
#### `.empty?`
|
174
165
|
|
175
166
|
Returns true if there are no currencies in the object.
|
data/lib/cashify/arithmetic.rb
CHANGED
data/lib/cashify/version.rb
CHANGED
data/lib/cashify.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cashify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Johan Halse
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Money trouble no more! Add, subtract, and have fun with money in different
|
14
14
|
currencies.
|
@@ -57,7 +57,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
57
57
|
- !ruby/object:Gem::Version
|
58
58
|
version: '0'
|
59
59
|
requirements: []
|
60
|
-
rubygems_version: 3.3
|
60
|
+
rubygems_version: 3.4.3
|
61
61
|
signing_key:
|
62
62
|
specification_version: 4
|
63
63
|
summary: A sensible way to handle money
|