monetize 1.13.0 → 2.0.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/LICENSE +1 -1
- data/README.md +6 -18
- data/lib/monetize/collection.rb +0 -2
- data/lib/monetize/core_extensions/hash.rb +0 -2
- data/lib/monetize/core_extensions/numeric.rb +0 -2
- data/lib/monetize/core_extensions/string.rb +0 -2
- data/lib/monetize/core_extensions/symbol.rb +0 -2
- data/lib/monetize/core_extensions.rb +0 -2
- data/lib/monetize/parser.rb +59 -56
- data/lib/monetize/version.rb +1 -3
- data/lib/monetize.rb +2 -11
- data/monetize.gemspec +23 -25
- metadata +8 -64
- data/.github/workflows/ruby.yml +0 -34
- data/.gitignore +0 -18
- data/.rubocop.yml +0 -32
- data/CONTRIBUTING.md +0 -20
- data/Gemfile +0 -13
- data/Rakefile +0 -18
- data/spec/core_extensions_spec.rb +0 -261
- data/spec/monetize_spec.rb +0 -633
- data/spec/spec_helper.rb +0 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 027fe3fe8fd8bf031ee1eeca954ccd33d64b09f7c1d611beef48758640f79ece
|
|
4
|
+
data.tar.gz: 252c3d7a5f4f922d0385ca6b7b10dffdbcf358a896afc5ba4a621298c966ae39
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 29bc1cef3e339731a0aa98f8d5198c81207f063c925650c5f42b8e23830f22dd1c35268b53d6f5296bfb0a15d59bbb08bc1b914967abc0eeda3282f7e0dcd8d4
|
|
7
|
+
data.tar.gz: af197d3990bc1a5488140912c7e5b39a9140a0bdf0247540ea3c9ef697044f20b8b9eab8691469bacf313a36e5ee3793c6c332e9353bf3cb676f98ba88bc1d8d
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
## 2.0.1
|
|
6
|
+
- Fix parsing of ISO codes not in `Monetize::Parser::CURRENCY_SYMBOLS`. `Monetize.parse('20.00 DKK')` returned 20.00 in the default currency instead of 20.00 DKK.
|
|
7
|
+
|
|
8
|
+
## 2.0.0
|
|
9
|
+
- **Breaking change**: Remove deprecated `Monetize.extract_cents`.
|
|
10
|
+
- **Breaking change**: Update Money gem dependency to ~> 7.0. See the [Money 7.0 upgrading guide](https://github.com/RubyMoney/money/blob/main/UPGRADING-7.0.md)
|
|
11
|
+
- **Breaking change**: Drop support for Ruby < 3.1
|
|
12
|
+
- Fix parsing multiple delimeters in the amount, after BigDecimal updates
|
|
13
|
+
- Fix unused variable `possible_major` Ruby warning.
|
|
14
|
+
|
|
15
|
+
## 1.13.0
|
|
16
|
+
- **Breaking change**: check ISO currency code validity when parsing strings with `to_money`
|
|
17
|
+
- Adds `expect_whole_subunits` option when fractional subunits are expected
|
|
18
|
+
- Add MYR, IDR, SGD, HKD, TWD, and PHP symbol to currency conversion
|
|
19
|
+
|
|
3
20
|
## 1.12.0
|
|
4
21
|
- Update `to_money` to match money-rails to_hash.
|
|
5
22
|
|
data/LICENSE
CHANGED
data/README.md
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
# Monetize
|
|
2
2
|
|
|
3
|
-
[](
|
|
4
|
-
[](https://gemnasium.com/RubyMoney/monetize)
|
|
7
|
-
[](http://opensource.org/licenses/MIT)
|
|
3
|
+
[](https://rubygems.org/gems/monetize)
|
|
4
|
+
[](https://github.com/RubyMoney/monetize/actions/workflows/ruby.yml)
|
|
5
|
+
[](https://opensource.org/license/MIT)
|
|
8
6
|
|
|
9
7
|
A library for converting various objects into `Money` objects.
|
|
10
8
|
|
|
@@ -28,16 +26,6 @@ Monetize.parse("GBP 100") == Money.new(100_00, "GBP")
|
|
|
28
26
|
"100".to_money == Money.new(100_00, "USD")
|
|
29
27
|
```
|
|
30
28
|
|
|
31
|
-
`parse` will return `nil` if it is unable to parse the input. Use `parse!` instead if you want a `Monetize::Error` (or one of the subclasses) to be raised instead:
|
|
32
|
-
|
|
33
|
-
```ruby
|
|
34
|
-
>> Monetize.parse('OMG 100')
|
|
35
|
-
=> nil
|
|
36
|
-
|
|
37
|
-
>> Monetize.parse!('OMG 100')
|
|
38
|
-
Monetize::ParseError: Unknown currency 'omg'
|
|
39
|
-
```
|
|
40
|
-
|
|
41
29
|
Optionally, enable the ability to assume the currency from a passed symbol. Otherwise, currency symbols will be ignored, and USD used as the default currency:
|
|
42
30
|
|
|
43
31
|
```ruby
|
|
@@ -49,7 +37,7 @@ Monetize.parse("£100") == Money.new(100_00, "GBP")
|
|
|
49
37
|
"€100".to_money == Money.new(100_00, "EUR")
|
|
50
38
|
```
|
|
51
39
|
|
|
52
|
-
Parsing can be improved where the input is not expected to contain
|
|
40
|
+
Parsing can be improved where the input is not expected to contain fractional subunits.
|
|
53
41
|
To do this, set `Monetize.expect_whole_subunits = true`
|
|
54
42
|
|
|
55
43
|
```ruby
|
|
@@ -60,12 +48,12 @@ Monetize.parse('EUR 10,000') == Money.new(10_000_00, "EUR")
|
|
|
60
48
|
```
|
|
61
49
|
|
|
62
50
|
Why does this work? If we expect fractional subunits then the parser will treat a single
|
|
63
|
-
delimiter as a decimal marker if it matches the currency's decimal marker. But often
|
|
51
|
+
delimiter as a decimal marker if it matches the currency's decimal marker. But often
|
|
64
52
|
this is not the case - a European site will show $10.000 because that's the local format.
|
|
65
53
|
As a human, if this was a stock ticker we might expect fractional cents. If it's a retail price we know it's actually an incorrect thousands separator.
|
|
66
54
|
|
|
67
55
|
|
|
68
|
-
Monetize can also parse a list of values, returning an array-like object ([Monetize::Collection](lib/collection.rb)):
|
|
56
|
+
Monetize can also parse a list of values, returning an array-like object ([Monetize::Collection](lib/monetize/collection.rb)):
|
|
69
57
|
|
|
70
58
|
```ruby
|
|
71
59
|
Monetize.parse_collection("€80/$100") == [Money.new(80_00, "EUR"), Money.new(100_00, "USD")]
|
data/lib/monetize/collection.rb
CHANGED
data/lib/monetize/parser.rb
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
|
|
3
1
|
module Monetize
|
|
4
2
|
class Parser
|
|
5
3
|
CURRENCY_SYMBOLS = {
|
|
@@ -31,11 +29,14 @@ module Monetize
|
|
|
31
29
|
'₱' => 'PHP',
|
|
32
30
|
}
|
|
33
31
|
|
|
32
|
+
CURRENCY_SYMBOL_REGEX = /(?<![A-Z])(#{CURRENCY_SYMBOLS.keys.map { |key| Regexp.escape(key) }.join('|')})(?![A-Z])/i
|
|
34
33
|
MULTIPLIER_SUFFIXES = { 'K' => 3, 'M' => 6, 'B' => 9, 'T' => 12 }
|
|
35
34
|
MULTIPLIER_SUFFIXES.default = 0
|
|
36
35
|
MULTIPLIER_REGEXP = Regexp.new(format('^(.*?\d)(%s)\b([^\d]*)$', MULTIPLIER_SUFFIXES.keys.join('|')), 'i')
|
|
37
36
|
|
|
38
37
|
DEFAULT_DECIMAL_MARK = '.'.freeze
|
|
38
|
+
DEFAULT_MINOR = "00".freeze
|
|
39
|
+
private_constant :DEFAULT_MINOR
|
|
39
40
|
|
|
40
41
|
def initialize(input, fallback_currency = Money.default_currency, options = {})
|
|
41
42
|
@input = input.to_s.strip
|
|
@@ -44,19 +45,13 @@ module Monetize
|
|
|
44
45
|
end
|
|
45
46
|
|
|
46
47
|
def parse
|
|
47
|
-
currency = Money::Currency.wrap(parse_currency)
|
|
48
|
-
|
|
49
48
|
multiplier_exp, input = extract_multiplier
|
|
50
49
|
|
|
51
50
|
num = input.gsub(/(?:^#{currency.symbol}|[^\d.,'-]+)/, '')
|
|
52
51
|
|
|
53
52
|
negative, num = extract_sign(num)
|
|
54
53
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
major, minor = extract_major_minor(num, currency)
|
|
58
|
-
|
|
59
|
-
amount = to_big_decimal([major, minor].join(DEFAULT_DECIMAL_MARK))
|
|
54
|
+
amount = to_big_decimal(normalize_number(num))
|
|
60
55
|
amount = apply_multiplier(multiplier_exp, amount)
|
|
61
56
|
amount = apply_sign(negative, amount)
|
|
62
57
|
|
|
@@ -65,6 +60,12 @@ module Monetize
|
|
|
65
60
|
|
|
66
61
|
private
|
|
67
62
|
|
|
63
|
+
def normalize_number(num)
|
|
64
|
+
clean_num = num.sub(/[\.|,]$/, "")
|
|
65
|
+
|
|
66
|
+
extract_major_minor(clean_num).join(DEFAULT_DECIMAL_MARK)
|
|
67
|
+
end
|
|
68
|
+
|
|
68
69
|
def to_big_decimal(value)
|
|
69
70
|
BigDecimal(value)
|
|
70
71
|
rescue ::ArgumentError => err
|
|
@@ -73,14 +74,19 @@ module Monetize
|
|
|
73
74
|
|
|
74
75
|
attr_reader :input, :fallback_currency, :options
|
|
75
76
|
|
|
77
|
+
def currency
|
|
78
|
+
@currency ||= Money::Currency.wrap(parse_currency)
|
|
79
|
+
end
|
|
80
|
+
|
|
76
81
|
def parse_currency
|
|
77
82
|
computed_currency = nil
|
|
78
83
|
computed_currency = input[/[A-Z]{2,3}/]
|
|
79
|
-
computed_currency = nil unless
|
|
84
|
+
computed_currency = nil unless Money::Currency.find(computed_currency)
|
|
80
85
|
computed_currency ||= compute_currency if assume_from_symbol?
|
|
81
86
|
|
|
82
|
-
|
|
83
|
-
|
|
87
|
+
found = computed_currency || fallback_currency || Money.default_currency
|
|
88
|
+
raise Money::Currency::UnknownCurrency unless found
|
|
89
|
+
found
|
|
84
90
|
end
|
|
85
91
|
|
|
86
92
|
def assume_from_symbol?
|
|
@@ -100,68 +106,69 @@ module Monetize
|
|
|
100
106
|
end
|
|
101
107
|
|
|
102
108
|
def compute_currency
|
|
103
|
-
match = input.match(
|
|
109
|
+
match = input.match(CURRENCY_SYMBOL_REGEX)
|
|
104
110
|
CURRENCY_SYMBOLS[match.to_s] if match
|
|
105
111
|
end
|
|
106
112
|
|
|
107
|
-
def
|
|
113
|
+
def remove_separator(num, separator)
|
|
114
|
+
num.gsub(separator, "")
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
def extract_major_minor(num)
|
|
108
118
|
used_delimiters = num.scan(/[^\d]/).uniq
|
|
109
119
|
|
|
110
120
|
case used_delimiters.length
|
|
111
121
|
when 0
|
|
112
|
-
[num,
|
|
122
|
+
[num, DEFAULT_MINOR]
|
|
123
|
+
when 1
|
|
124
|
+
extract_major_minor_with_single_delimiter(num, used_delimiters.first)
|
|
113
125
|
when 2
|
|
114
126
|
thousands_separator, decimal_mark = used_delimiters
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
127
|
+
num = remove_separator(num, thousands_separator)
|
|
128
|
+
|
|
129
|
+
split_major_minor(num, decimal_mark)
|
|
118
130
|
else
|
|
119
131
|
fail ParseError, 'Invalid amount'
|
|
120
132
|
end
|
|
121
133
|
end
|
|
122
134
|
|
|
123
|
-
def
|
|
124
|
-
minor.length == currency.
|
|
135
|
+
def minor_has_correct_decimal_places_for_currency?(minor)
|
|
136
|
+
minor.length == currency.decimal_places
|
|
125
137
|
end
|
|
126
138
|
|
|
127
|
-
def extract_major_minor_with_single_delimiter(num,
|
|
139
|
+
def extract_major_minor_with_single_delimiter(num, delimiter)
|
|
128
140
|
if expect_whole_subunits?
|
|
129
141
|
possible_major, possible_minor = split_major_minor(num, delimiter)
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
extract_major_minor_with_tentative_delimiter(num, delimiter)
|
|
134
|
-
end
|
|
135
|
-
else
|
|
136
|
-
if delimiter == currency.decimal_mark
|
|
137
|
-
split_major_minor(num, delimiter)
|
|
138
|
-
elsif Monetize.enforce_currency_delimiters && delimiter == currency.thousands_separator
|
|
139
|
-
[num.gsub(delimiter, ''), 0]
|
|
140
|
-
else
|
|
141
|
-
extract_major_minor_with_tentative_delimiter(num, delimiter)
|
|
142
|
+
|
|
143
|
+
if minor_has_correct_decimal_places_for_currency?(possible_minor)
|
|
144
|
+
return [possible_major, possible_minor]
|
|
142
145
|
end
|
|
146
|
+
elsif delimiter == currency.decimal_mark
|
|
147
|
+
return split_major_minor(num, delimiter)
|
|
148
|
+
elsif Monetize.enforce_currency_delimiters && delimiter == currency.thousands_separator
|
|
149
|
+
return [remove_separator(num, delimiter), DEFAULT_MINOR]
|
|
143
150
|
end
|
|
151
|
+
|
|
152
|
+
extract_major_minor_with_tentative_delimiter(num, delimiter)
|
|
144
153
|
end
|
|
145
154
|
|
|
146
155
|
def extract_major_minor_with_tentative_delimiter(num, delimiter)
|
|
147
156
|
if num.scan(delimiter).length > 1
|
|
148
157
|
# Multiple matches; treat as thousands separator
|
|
149
|
-
[num
|
|
150
|
-
|
|
151
|
-
possible_major, possible_minor = split_major_minor(num, delimiter)
|
|
158
|
+
return [remove_separator(num, delimiter), DEFAULT_MINOR]
|
|
159
|
+
end
|
|
152
160
|
|
|
153
|
-
|
|
154
|
-
is_decimal_mark = possible_minor.length != 3 ||
|
|
155
|
-
possible_major.length > 3 ||
|
|
156
|
-
possible_major.to_i == 0 ||
|
|
157
|
-
(!expect_whole_subunits? && delimiter == '.')
|
|
161
|
+
possible_major, possible_minor = split_major_minor(num, delimiter)
|
|
158
162
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
163
|
+
# Doesn't look like thousands separator
|
|
164
|
+
is_decimal_mark = possible_minor.length != 3 ||
|
|
165
|
+
possible_major.length > 3 ||
|
|
166
|
+
possible_major.to_i == 0 ||
|
|
167
|
+
(!expect_whole_subunits? && delimiter == ".")
|
|
168
|
+
|
|
169
|
+
return [possible_major, possible_minor] if is_decimal_mark
|
|
170
|
+
|
|
171
|
+
["#{possible_major}#{possible_minor}", DEFAULT_MINOR]
|
|
165
172
|
end
|
|
166
173
|
|
|
167
174
|
def extract_multiplier
|
|
@@ -179,17 +186,13 @@ module Monetize
|
|
|
179
186
|
result
|
|
180
187
|
end
|
|
181
188
|
|
|
182
|
-
def regex_safe_symbols
|
|
183
|
-
CURRENCY_SYMBOLS.keys.map { |key| Regexp.escape(key) }.join('|')
|
|
184
|
-
end
|
|
185
|
-
|
|
186
189
|
def split_major_minor(num, delimiter)
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
+
splits = num.split(delimiter)
|
|
191
|
+
fail ParseError, 'Invalid amount (multiple delimiters)' if splits.length > 2
|
|
192
|
+
|
|
193
|
+
splits[1] ||= DEFAULT_MINOR
|
|
190
194
|
|
|
191
|
-
|
|
192
|
-
/(?<![A-Z])(#{regex_safe_symbols})(?![A-Z])/i
|
|
195
|
+
splits
|
|
193
196
|
end
|
|
194
197
|
end
|
|
195
198
|
end
|
data/lib/monetize/version.rb
CHANGED
data/lib/monetize.rb
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
|
|
3
1
|
require 'money'
|
|
4
2
|
require 'monetize/core_extensions'
|
|
5
3
|
require 'monetize/errors'
|
|
@@ -21,8 +19,8 @@ module Monetize
|
|
|
21
19
|
attr_accessor :enforce_currency_delimiters
|
|
22
20
|
|
|
23
21
|
|
|
24
|
-
# Where this set to true, the behavior for parsing thousands separators is changed to
|
|
25
|
-
# expect that eg. €10.000 is EUR 10 000 and not EUR 10.000 - it's incredibly rare when parsing
|
|
22
|
+
# Where this set to true, the behavior for parsing thousands separators is changed to
|
|
23
|
+
# expect that eg. €10.000 is EUR 10 000 and not EUR 10.000 - it's incredibly rare when parsing
|
|
26
24
|
# human text that we're dealing with fractions of cents.
|
|
27
25
|
attr_accessor :expect_whole_subunits
|
|
28
26
|
|
|
@@ -70,12 +68,5 @@ module Monetize
|
|
|
70
68
|
fail ArgumentError, "'value' should be a type of Numeric" unless value.is_a?(Numeric)
|
|
71
69
|
Money.from_amount(value, currency)
|
|
72
70
|
end
|
|
73
|
-
|
|
74
|
-
def extract_cents(input, currency = Money.default_currency)
|
|
75
|
-
warn '[DEPRECATION] Monetize.extract_cents is deprecated. Use Monetize.parse().cents'
|
|
76
|
-
|
|
77
|
-
money = parse(input, currency)
|
|
78
|
-
money.cents if money
|
|
79
|
-
end
|
|
80
71
|
end
|
|
81
72
|
end
|
data/monetize.gemspec
CHANGED
|
@@ -1,33 +1,31 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
lib = File.expand_path("lib", __dir__)
|
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
-
require
|
|
5
|
-
require 'English'
|
|
5
|
+
require "monetize/version"
|
|
6
6
|
|
|
7
|
-
Gem::Specification.new do |
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
Gem::Specification.new do |s|
|
|
8
|
+
s.name = "monetize"
|
|
9
|
+
s.version = Monetize::VERSION
|
|
10
|
+
s.platform = Gem::Platform::RUBY
|
|
11
|
+
s.authors = ["Shane Emmons", "Anthony Dmitriyev"]
|
|
12
|
+
s.email = ["shane@emmons.io", "anthony.dmitriyev@gmail.com"]
|
|
13
|
+
s.homepage = "https://github.com/RubyMoney/monetize"
|
|
14
|
+
s.summary = "A library for converting various objects into `Money` objects."
|
|
15
|
+
s.description = "A library for converting various objects into `Money` objects."
|
|
16
|
+
s.license = "MIT"
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
19
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
20
|
-
spec.require_paths = ['lib']
|
|
18
|
+
s.add_dependency "money", "~> 7.0"
|
|
21
19
|
|
|
22
|
-
|
|
20
|
+
s.required_ruby_version = ">= 3.1"
|
|
23
21
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
spec.add_development_dependency 'rspec', '~> 3.0'
|
|
22
|
+
s.files = `git ls-files -z -- lib/* CHANGELOG.md LICENSE monetize.gemspec README.md`.split("\x0")
|
|
23
|
+
s.require_paths = ["lib"]
|
|
27
24
|
|
|
28
|
-
if
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
if s.respond_to?(:metadata)
|
|
26
|
+
s.metadata["changelog_uri"] = "https://github.com/RubyMoney/monetize/blob/master/CHANGELOG.md"
|
|
27
|
+
s.metadata["source_code_uri"] = "https://github.com/RubyMoney/monetize/"
|
|
28
|
+
s.metadata["bug_tracker_uri"] = "https://github.com/RubyMoney/monetize/issues"
|
|
29
|
+
s.metadata["rubygems_mfa_required"] = "true"
|
|
32
30
|
end
|
|
33
31
|
end
|
metadata
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: monetize
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Shane Emmons
|
|
8
8
|
- Anthony Dmitriyev
|
|
9
|
-
autorequire:
|
|
10
9
|
bindir: bin
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date:
|
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
13
12
|
dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
|
15
14
|
name: money
|
|
@@ -17,56 +16,14 @@ dependencies:
|
|
|
17
16
|
requirements:
|
|
18
17
|
- - "~>"
|
|
19
18
|
- !ruby/object:Gem::Version
|
|
20
|
-
version: '
|
|
19
|
+
version: '7.0'
|
|
21
20
|
type: :runtime
|
|
22
21
|
prerelease: false
|
|
23
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
24
23
|
requirements:
|
|
25
24
|
- - "~>"
|
|
26
25
|
- !ruby/object:Gem::Version
|
|
27
|
-
version: '
|
|
28
|
-
- !ruby/object:Gem::Dependency
|
|
29
|
-
name: bundler
|
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
|
31
|
-
requirements:
|
|
32
|
-
- - ">="
|
|
33
|
-
- !ruby/object:Gem::Version
|
|
34
|
-
version: '0'
|
|
35
|
-
type: :development
|
|
36
|
-
prerelease: false
|
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
38
|
-
requirements:
|
|
39
|
-
- - ">="
|
|
40
|
-
- !ruby/object:Gem::Version
|
|
41
|
-
version: '0'
|
|
42
|
-
- !ruby/object:Gem::Dependency
|
|
43
|
-
name: rake
|
|
44
|
-
requirement: !ruby/object:Gem::Requirement
|
|
45
|
-
requirements:
|
|
46
|
-
- - "~>"
|
|
47
|
-
- !ruby/object:Gem::Version
|
|
48
|
-
version: '10.2'
|
|
49
|
-
type: :development
|
|
50
|
-
prerelease: false
|
|
51
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
52
|
-
requirements:
|
|
53
|
-
- - "~>"
|
|
54
|
-
- !ruby/object:Gem::Version
|
|
55
|
-
version: '10.2'
|
|
56
|
-
- !ruby/object:Gem::Dependency
|
|
57
|
-
name: rspec
|
|
58
|
-
requirement: !ruby/object:Gem::Requirement
|
|
59
|
-
requirements:
|
|
60
|
-
- - "~>"
|
|
61
|
-
- !ruby/object:Gem::Version
|
|
62
|
-
version: '3.0'
|
|
63
|
-
type: :development
|
|
64
|
-
prerelease: false
|
|
65
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
66
|
-
requirements:
|
|
67
|
-
- - "~>"
|
|
68
|
-
- !ruby/object:Gem::Version
|
|
69
|
-
version: '3.0'
|
|
26
|
+
version: '7.0'
|
|
70
27
|
description: A library for converting various objects into `Money` objects.
|
|
71
28
|
email:
|
|
72
29
|
- shane@emmons.io
|
|
@@ -75,15 +32,9 @@ executables: []
|
|
|
75
32
|
extensions: []
|
|
76
33
|
extra_rdoc_files: []
|
|
77
34
|
files:
|
|
78
|
-
- ".github/workflows/ruby.yml"
|
|
79
|
-
- ".gitignore"
|
|
80
|
-
- ".rubocop.yml"
|
|
81
35
|
- CHANGELOG.md
|
|
82
|
-
- CONTRIBUTING.md
|
|
83
|
-
- Gemfile
|
|
84
36
|
- LICENSE
|
|
85
37
|
- README.md
|
|
86
|
-
- Rakefile
|
|
87
38
|
- lib/monetize.rb
|
|
88
39
|
- lib/monetize/collection.rb
|
|
89
40
|
- lib/monetize/core_extensions.rb
|
|
@@ -96,9 +47,6 @@ files:
|
|
|
96
47
|
- lib/monetize/parser.rb
|
|
97
48
|
- lib/monetize/version.rb
|
|
98
49
|
- monetize.gemspec
|
|
99
|
-
- spec/core_extensions_spec.rb
|
|
100
|
-
- spec/monetize_spec.rb
|
|
101
|
-
- spec/spec_helper.rb
|
|
102
50
|
homepage: https://github.com/RubyMoney/monetize
|
|
103
51
|
licenses:
|
|
104
52
|
- MIT
|
|
@@ -106,7 +54,7 @@ metadata:
|
|
|
106
54
|
changelog_uri: https://github.com/RubyMoney/monetize/blob/master/CHANGELOG.md
|
|
107
55
|
source_code_uri: https://github.com/RubyMoney/monetize/
|
|
108
56
|
bug_tracker_uri: https://github.com/RubyMoney/monetize/issues
|
|
109
|
-
|
|
57
|
+
rubygems_mfa_required: 'true'
|
|
110
58
|
rdoc_options: []
|
|
111
59
|
require_paths:
|
|
112
60
|
- lib
|
|
@@ -114,18 +62,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
114
62
|
requirements:
|
|
115
63
|
- - ">="
|
|
116
64
|
- !ruby/object:Gem::Version
|
|
117
|
-
version: '
|
|
65
|
+
version: '3.1'
|
|
118
66
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
67
|
requirements:
|
|
120
68
|
- - ">="
|
|
121
69
|
- !ruby/object:Gem::Version
|
|
122
70
|
version: '0'
|
|
123
71
|
requirements: []
|
|
124
|
-
rubygems_version:
|
|
125
|
-
signing_key:
|
|
72
|
+
rubygems_version: 4.0.17
|
|
126
73
|
specification_version: 4
|
|
127
74
|
summary: A library for converting various objects into `Money` objects.
|
|
128
|
-
test_files:
|
|
129
|
-
- spec/core_extensions_spec.rb
|
|
130
|
-
- spec/monetize_spec.rb
|
|
131
|
-
- spec/spec_helper.rb
|
|
75
|
+
test_files: []
|
data/.github/workflows/ruby.yml
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
# This workflow uses actions that are not certified by GitHub.
|
|
2
|
-
# They are provided by a third-party and are governed by
|
|
3
|
-
# separate terms of service, privacy policy, and support
|
|
4
|
-
# documentation.
|
|
5
|
-
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
|
6
|
-
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
|
7
|
-
|
|
8
|
-
name: Ruby
|
|
9
|
-
|
|
10
|
-
on:
|
|
11
|
-
push:
|
|
12
|
-
branches: [ main ]
|
|
13
|
-
pull_request:
|
|
14
|
-
branches: [ main ]
|
|
15
|
-
|
|
16
|
-
jobs:
|
|
17
|
-
test:
|
|
18
|
-
|
|
19
|
-
runs-on: ubuntu-latest
|
|
20
|
-
strategy:
|
|
21
|
-
matrix:
|
|
22
|
-
ruby-version: ['2.6', '2.7', '3.0', '3.1', '3.2']
|
|
23
|
-
|
|
24
|
-
steps:
|
|
25
|
-
- uses: actions/checkout@v3
|
|
26
|
-
- name: Set up Ruby
|
|
27
|
-
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
|
28
|
-
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
|
29
|
-
uses: ruby/setup-ruby@v1
|
|
30
|
-
with:
|
|
31
|
-
ruby-version: ${{ matrix.ruby-version }}
|
|
32
|
-
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
|
33
|
-
- name: Run tests
|
|
34
|
-
run: bundle exec rspec spec
|
data/.gitignore
DELETED
data/.rubocop.yml
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
Documentation:
|
|
2
|
-
Enabled: false
|
|
3
|
-
Metrics/AbcSize:
|
|
4
|
-
Enabled: false
|
|
5
|
-
Metrics/ClassLength:
|
|
6
|
-
Enabled: false
|
|
7
|
-
Metrics/MethodLength:
|
|
8
|
-
Enabled: false
|
|
9
|
-
Metrics/ModuleLength:
|
|
10
|
-
Enabled: false
|
|
11
|
-
Style/AndOr:
|
|
12
|
-
Enabled: false
|
|
13
|
-
Style/ClassAndModuleChildren:
|
|
14
|
-
Enabled: false
|
|
15
|
-
Style/PerlBackrefs:
|
|
16
|
-
Enabled: false
|
|
17
|
-
|
|
18
|
-
Style/CollectionMethods:
|
|
19
|
-
Enabled: yes
|
|
20
|
-
Lint/LiteralInInterpolation:
|
|
21
|
-
Enabled: yes
|
|
22
|
-
|
|
23
|
-
Metrics/LineLength:
|
|
24
|
-
Max: 120
|
|
25
|
-
Metrics/ParameterLists:
|
|
26
|
-
CountKeywordArgs: false
|
|
27
|
-
Style/DotPosition:
|
|
28
|
-
EnforcedStyle: trailing
|
|
29
|
-
Style/EmptyElse:
|
|
30
|
-
EnforcedStyle: empty
|
|
31
|
-
Style/SpaceInsideHashLiteralBraces:
|
|
32
|
-
EnforcedStyle: no_space
|