monetize 1.12.0 → 2.0.0
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 +14 -0
- data/LICENSE +1 -1
- data/README.md +19 -19
- 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 +38 -20
- data/lib/monetize/version.rb +1 -3
- data/lib/monetize.rb +6 -9
- 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 -587
- 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: 77ba1cf94643805ce15012361fda9aaadf3d029483b7c5e557dae4a0cd220c2f
|
|
4
|
+
data.tar.gz: 8b9d5c77362a24cb9483d2cd02a0f35e5382a289c0eaacc8e44716408ef2a228
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 528b67577977e7fb1300cac86a086cc16d9a1941bb93270ed913b83c898b35b3c853583113ece518aeee68f099c0d5ee03bf559a68dffbabc4ed52aa3aaefdce
|
|
7
|
+
data.tar.gz: d64891590b9c964dc7324f57e45262471922be81248914f8c4430649a9ee17a23e019ae99171762d27b07c1888db51d23f0be580cc0977fd0fa069e3aa7a6563
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
## 2.0.0
|
|
6
|
+
- **Breaking change**: Remove deprecated `Monetize.extract_cents`.
|
|
7
|
+
- **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)
|
|
8
|
+
- **Breaking change**: Drop support for Ruby < 3.1
|
|
9
|
+
- Fix parsing multiple delimeters in the amount, after BigDecimal updates
|
|
10
|
+
- Fix unused variable `possible_major` Ruby warning.
|
|
11
|
+
|
|
12
|
+
## 1.13.0
|
|
13
|
+
- **Breaking change**: check ISO currency code validity when parsing strings with `to_money`
|
|
14
|
+
- Adds `expect_whole_subunits` option when fractional subunits are expected
|
|
15
|
+
- Add MYR, IDR, SGD, HKD, TWD, and PHP symbol to currency conversion
|
|
16
|
+
|
|
3
17
|
## 1.12.0
|
|
4
18
|
- Update `to_money` to match money-rails to_hash.
|
|
5
19
|
|
data/LICENSE
CHANGED
data/README.md
CHANGED
|
@@ -1,22 +1,16 @@
|
|
|
1
1
|
# Monetize
|
|
2
2
|
|
|
3
3
|
[](http://badge.fury.io/rb/monetize)
|
|
4
|
-
[](https://codeclimate.com/github/RubyMoney/monetize)
|
|
6
|
-
[](https://gemnasium.com/RubyMoney/monetize)
|
|
4
|
+
[](https://github.com/RubyMoney/monetize/actions/workflows/ruby.yml)
|
|
7
5
|
[](http://opensource.org/licenses/MIT)
|
|
8
6
|
|
|
9
7
|
A library for converting various objects into `Money` objects.
|
|
10
8
|
|
|
11
9
|
## Installation
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
Run:
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
And then execute:
|
|
18
|
-
|
|
19
|
-
$ bundle
|
|
13
|
+
bundle add monetize
|
|
20
14
|
|
|
21
15
|
Or install it yourself as:
|
|
22
16
|
|
|
@@ -32,16 +26,6 @@ Monetize.parse("GBP 100") == Money.new(100_00, "GBP")
|
|
|
32
26
|
"100".to_money == Money.new(100_00, "USD")
|
|
33
27
|
```
|
|
34
28
|
|
|
35
|
-
`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:
|
|
36
|
-
|
|
37
|
-
```ruby
|
|
38
|
-
>> Monetize.parse('OMG 100')
|
|
39
|
-
=> nil
|
|
40
|
-
|
|
41
|
-
>> Monetize.parse!('OMG 100')
|
|
42
|
-
Monetize::ParseError: Unknown currency 'omg'
|
|
43
|
-
```
|
|
44
|
-
|
|
45
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:
|
|
46
30
|
|
|
47
31
|
```ruby
|
|
@@ -53,6 +37,22 @@ Monetize.parse("£100") == Money.new(100_00, "GBP")
|
|
|
53
37
|
"€100".to_money == Money.new(100_00, "EUR")
|
|
54
38
|
```
|
|
55
39
|
|
|
40
|
+
Parsing can be improved where the input is not expected to contain fractional subunits.
|
|
41
|
+
To do this, set `Monetize.expect_whole_subunits = true`
|
|
42
|
+
|
|
43
|
+
```ruby
|
|
44
|
+
Monetize.parse('EUR 10,000') == Money.new(100_00, "EUR")
|
|
45
|
+
|
|
46
|
+
Monetize.expect_whole_subunits = true
|
|
47
|
+
Monetize.parse('EUR 10,000') == Money.new(10_000_00, "EUR")
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Why does this work? If we expect fractional subunits then the parser will treat a single
|
|
51
|
+
delimiter as a decimal marker if it matches the currency's decimal marker. But often
|
|
52
|
+
this is not the case - a European site will show $10.000 because that's the local format.
|
|
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.
|
|
54
|
+
|
|
55
|
+
|
|
56
56
|
Monetize can also parse a list of values, returning an array-like object ([Monetize::Collection](lib/collection.rb)):
|
|
57
57
|
|
|
58
58
|
```ruby
|
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 = {
|
|
@@ -8,6 +6,8 @@ module Monetize
|
|
|
8
6
|
'£' => 'GBP',
|
|
9
7
|
'₤' => 'GBP',
|
|
10
8
|
'R$' => 'BRL',
|
|
9
|
+
'RM' => 'MYR',
|
|
10
|
+
'Rp' => 'IDR',
|
|
11
11
|
'R' => 'ZAR',
|
|
12
12
|
'¥' => 'JPY',
|
|
13
13
|
'C$' => 'CAD',
|
|
@@ -23,8 +23,13 @@ module Monetize
|
|
|
23
23
|
'zł' => 'PLN',
|
|
24
24
|
'₸' => 'KZT',
|
|
25
25
|
"₩" => 'KRW',
|
|
26
|
+
'S$' => 'SGD',
|
|
27
|
+
'HK$'=> 'HKD',
|
|
28
|
+
'NT$'=> 'TWD',
|
|
29
|
+
'₱' => 'PHP',
|
|
26
30
|
}
|
|
27
31
|
|
|
32
|
+
CURRENCY_SYMBOL_REGEX = /(?<![A-Z])(#{CURRENCY_SYMBOLS.keys.map { |key| Regexp.escape(key) }.join('|')})(?![A-Z])/i
|
|
28
33
|
MULTIPLIER_SUFFIXES = { 'K' => 3, 'M' => 6, 'B' => 9, 'T' => 12 }
|
|
29
34
|
MULTIPLIER_SUFFIXES.default = 0
|
|
30
35
|
MULTIPLIER_REGEXP = Regexp.new(format('^(.*?\d)(%s)\b([^\d]*)$', MULTIPLIER_SUFFIXES.keys.join('|')), 'i')
|
|
@@ -70,16 +75,22 @@ module Monetize
|
|
|
70
75
|
def parse_currency
|
|
71
76
|
computed_currency = nil
|
|
72
77
|
computed_currency = input[/[A-Z]{2,3}/]
|
|
78
|
+
computed_currency = nil unless Monetize::Parser::CURRENCY_SYMBOLS.value?(computed_currency)
|
|
73
79
|
computed_currency ||= compute_currency if assume_from_symbol?
|
|
74
80
|
|
|
75
|
-
|
|
76
|
-
|
|
81
|
+
found = computed_currency || fallback_currency || Money.default_currency
|
|
82
|
+
raise Money::Currency::UnknownCurrency unless found
|
|
83
|
+
found
|
|
77
84
|
end
|
|
78
85
|
|
|
79
86
|
def assume_from_symbol?
|
|
80
87
|
options.fetch(:assume_from_symbol) { Monetize.assume_from_symbol }
|
|
81
88
|
end
|
|
82
89
|
|
|
90
|
+
def expect_whole_subunits?
|
|
91
|
+
options.fetch(:expect_whole_subunits) { Monetize.expect_whole_subunits }
|
|
92
|
+
end
|
|
93
|
+
|
|
83
94
|
def apply_multiplier(multiplier_exp, amount)
|
|
84
95
|
amount * 10**multiplier_exp
|
|
85
96
|
end
|
|
@@ -89,7 +100,7 @@ module Monetize
|
|
|
89
100
|
end
|
|
90
101
|
|
|
91
102
|
def compute_currency
|
|
92
|
-
match = input.match(
|
|
103
|
+
match = input.match(CURRENCY_SYMBOL_REGEX)
|
|
93
104
|
CURRENCY_SYMBOLS[match.to_s] if match
|
|
94
105
|
end
|
|
95
106
|
|
|
@@ -109,13 +120,26 @@ module Monetize
|
|
|
109
120
|
end
|
|
110
121
|
end
|
|
111
122
|
|
|
123
|
+
def minor_has_correct_dp_for_currency_subunit?(minor, currency)
|
|
124
|
+
minor.length == currency.subunit_to_unit.to_s.length - 1
|
|
125
|
+
end
|
|
126
|
+
|
|
112
127
|
def extract_major_minor_with_single_delimiter(num, currency, delimiter)
|
|
113
|
-
if
|
|
114
|
-
split_major_minor(num, delimiter)
|
|
115
|
-
|
|
116
|
-
|
|
128
|
+
if expect_whole_subunits?
|
|
129
|
+
_possible_major, possible_minor = split_major_minor(num, delimiter)
|
|
130
|
+
if minor_has_correct_dp_for_currency_subunit?(possible_minor, currency)
|
|
131
|
+
split_major_minor(num, delimiter)
|
|
132
|
+
else
|
|
133
|
+
extract_major_minor_with_tentative_delimiter(num, delimiter)
|
|
134
|
+
end
|
|
117
135
|
else
|
|
118
|
-
|
|
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
|
+
end
|
|
119
143
|
end
|
|
120
144
|
end
|
|
121
145
|
|
|
@@ -130,7 +154,7 @@ module Monetize
|
|
|
130
154
|
is_decimal_mark = possible_minor.length != 3 ||
|
|
131
155
|
possible_major.length > 3 ||
|
|
132
156
|
possible_major.to_i == 0 ||
|
|
133
|
-
delimiter == '.'
|
|
157
|
+
(!expect_whole_subunits? && delimiter == '.')
|
|
134
158
|
|
|
135
159
|
if is_decimal_mark
|
|
136
160
|
[possible_major, possible_minor]
|
|
@@ -155,17 +179,11 @@ module Monetize
|
|
|
155
179
|
result
|
|
156
180
|
end
|
|
157
181
|
|
|
158
|
-
def regex_safe_symbols
|
|
159
|
-
CURRENCY_SYMBOLS.keys.map { |key| Regexp.escape(key) }.join('|')
|
|
160
|
-
end
|
|
161
|
-
|
|
162
182
|
def split_major_minor(num, delimiter)
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
end
|
|
183
|
+
splits = num.split(delimiter)
|
|
184
|
+
fail ParseError, 'Invalid amount (multiple delimiters)' if splits.length > 2
|
|
166
185
|
|
|
167
|
-
|
|
168
|
-
/(?<![A-Z])(#{regex_safe_symbols})(?![A-Z])/i
|
|
186
|
+
[splits[0], splits[1] || '00']
|
|
169
187
|
end
|
|
170
188
|
end
|
|
171
189
|
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'
|
|
@@ -20,6 +18,12 @@ module Monetize
|
|
|
20
18
|
# to true to enforce the delimiters set in the currency all the time.
|
|
21
19
|
attr_accessor :enforce_currency_delimiters
|
|
22
20
|
|
|
21
|
+
|
|
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
|
|
24
|
+
# human text that we're dealing with fractions of cents.
|
|
25
|
+
attr_accessor :expect_whole_subunits
|
|
26
|
+
|
|
23
27
|
def parse(input, currency = Money.default_currency, options = {})
|
|
24
28
|
parse! input, currency, options
|
|
25
29
|
rescue Error
|
|
@@ -64,12 +68,5 @@ module Monetize
|
|
|
64
68
|
fail ArgumentError, "'value' should be a type of Numeric" unless value.is_a?(Numeric)
|
|
65
69
|
Money.from_amount(value, currency)
|
|
66
70
|
end
|
|
67
|
-
|
|
68
|
-
def extract_cents(input, currency = Money.default_currency)
|
|
69
|
-
warn '[DEPRECATION] Monetize.extract_cents is deprecated. Use Monetize.parse().cents'
|
|
70
|
-
|
|
71
|
-
money = parse(input, currency)
|
|
72
|
-
money.cents if money
|
|
73
|
-
end
|
|
74
71
|
end
|
|
75
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.0
|
|
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.0
|
|
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']
|
|
23
|
-
|
|
24
|
-
steps:
|
|
25
|
-
- uses: actions/checkout@v2
|
|
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
|
data/CONTRIBUTING.md
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# Contribution Guidelines
|
|
2
|
-
|
|
3
|
-
## Steps
|
|
4
|
-
|
|
5
|
-
1. Fork [the repo](https://github.com/RubyMoney/monetize)
|
|
6
|
-
2. Grab dependencies: `bundle install`
|
|
7
|
-
3. Make sure everything is working: `bundle exec rspec spec`
|
|
8
|
-
4. Create your feature branch (`git checkout -b my-new-feature`)
|
|
9
|
-
5. Make your changes
|
|
10
|
-
6. Test your changes
|
|
11
|
-
7. Commit your changes (`git commit -am 'Add some feature'`)
|
|
12
|
-
8. Push to the branch (`git push origin my-new-feature`)
|
|
13
|
-
9. Create a Pull Request
|
|
14
|
-
10. Celebrate!!!!!
|
|
15
|
-
|
|
16
|
-
## Notes
|
|
17
|
-
|
|
18
|
-
When contributing, please make sure to update the [CHANGELOG.md](CHANGELOG.md) when you submit
|
|
19
|
-
your pull request. Upon merging of your first pull request, you will be
|
|
20
|
-
given commit access to the repository.
|
data/Gemfile
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
source 'https://rubygems.org'
|
|
2
|
-
|
|
3
|
-
# JSON and I18n gem no longer supports ruby < 2.0.0
|
|
4
|
-
if defined?(JRUBY_VERSION)
|
|
5
|
-
gem 'json'
|
|
6
|
-
elsif RUBY_VERSION =~ /^1/
|
|
7
|
-
gem 'json', '~> 1.8.3'
|
|
8
|
-
gem 'tins', '~> 1.6.0'
|
|
9
|
-
gem 'term-ansicolor', '~> 1.3.0'
|
|
10
|
-
gem 'i18n', '~> 0.9'
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
gemspec
|
data/Rakefile
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
require 'bundler/gem_tasks'
|
|
2
|
-
require 'rspec/core/rake_task'
|
|
3
|
-
|
|
4
|
-
task default: :spec
|
|
5
|
-
|
|
6
|
-
RSpec::Core::RakeTask.new
|
|
7
|
-
|
|
8
|
-
task :environment do
|
|
9
|
-
require_relative 'lib/monetize'
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
desc 'Start a console with library loaded'
|
|
13
|
-
task console: :environment do
|
|
14
|
-
require 'irb'
|
|
15
|
-
require 'irb/completion'
|
|
16
|
-
ARGV.clear
|
|
17
|
-
IRB.start
|
|
18
|
-
end
|