monetize 1.9.0 → 1.10.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 +5 -5
 - data/.github/workflows/ruby.yml +34 -0
 - data/.gitignore +1 -0
 - data/CHANGELOG.md +16 -0
 - data/Gemfile +2 -3
 - data/README.md +0 -1
 - data/lib/monetize.rb +7 -4
 - data/lib/monetize/parser.rb +22 -40
 - data/lib/monetize/version.rb +1 -1
 - data/monetize.gemspec +10 -4
 - data/spec/core_extensions_spec.rb +27 -4
 - data/spec/monetize_spec.rb +56 -17
 - data/spec/spec_helper.rb +0 -2
 - metadata +21 -18
 - data/.coveralls.yml +0 -1
 - data/.travis.yml +0 -15
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 2 
     | 
    
         
            +
            SHA256:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 63f57158028647c2bde5bac4c2186e16e9a3874d6c6d756b08e091d1357fcfcc
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 5dd093ceef480ffd21fbfaa3a0912cdc7421f797c4570a2a8bde9665534aa6ff
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 6b4001dd8967421873f84b9b0201bd0985d1388d89c41c2c048498db185cd2d4bdd144c581293fff70e34c5fb88aecbf68f2e3d2d086f1f278f58047e519aebe
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 468cc1fd1f127eb570e8599ef20309240f5e95c5731374848c663995d4935e4bb6773ffd40691d2bd4148c58e51e641806a3d7a97d25851a5877bc74621fe059
         
     | 
| 
         @@ -0,0 +1,34 @@ 
     | 
|
| 
      
 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: [ master ]
         
     | 
| 
      
 13 
     | 
    
         
            +
              pull_request:
         
     | 
| 
      
 14 
     | 
    
         
            +
                branches: [ master ]
         
     | 
| 
      
 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
    CHANGED
    
    
    
        data/CHANGELOG.md
    CHANGED
    
    | 
         @@ -1,5 +1,21 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # Changelog
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            ## 1.10.0
         
     | 
| 
      
 4 
     | 
    
         
            +
            - When using the `assume_from_symbol` option, the currency in the input string will be used over the assumed currency based on symbol. For example, `$1.05 CAD` will use `CAD` instead of `USD`.
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            ## 1.9.4
         
     | 
| 
      
 7 
     | 
    
         
            +
            - Fix symbol parsing that are surrounded by other characters
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            ## 1.9.3
         
     | 
| 
      
 10 
     | 
    
         
            +
            - Fix input parsing when currency symbol after the amount
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            ## 1.9.2
         
     | 
| 
      
 13 
     | 
    
         
            +
            - Respect Money.rounding_mode when parsing strings
         
     | 
| 
      
 14 
     | 
    
         
            +
            - Deprecate Monetize.extract_cents
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            ## 1.9.1
         
     | 
| 
      
 17 
     | 
    
         
            +
            - Ruby 2.6 support
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
       3 
19 
     | 
    
         
             
            ## 1.9.0
         
     | 
| 
       4 
20 
     | 
    
         
             
            - Relax Money gem dependency to ~> 6.12
         
     | 
| 
       5 
21 
     | 
    
         
             
            - Refactor `Monetize::Parser`
         
     | 
    
        data/Gemfile
    CHANGED
    
    | 
         @@ -1,14 +1,13 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            source 'https://rubygems.org'
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            gem  
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
            # JSON gem no longer supports ruby < 2.0.0
         
     | 
| 
      
 3 
     | 
    
         
            +
            # JSON and I18n gem no longer supports ruby < 2.0.0
         
     | 
| 
       6 
4 
     | 
    
         
             
            if defined?(JRUBY_VERSION)
         
     | 
| 
       7 
5 
     | 
    
         
             
              gem 'json'
         
     | 
| 
       8 
6 
     | 
    
         
             
            elsif RUBY_VERSION =~ /^1/
         
     | 
| 
       9 
7 
     | 
    
         
             
              gem 'json', '~> 1.8.3'
         
     | 
| 
       10 
8 
     | 
    
         
             
              gem 'tins', '~> 1.6.0'
         
     | 
| 
       11 
9 
     | 
    
         
             
              gem 'term-ansicolor', '~> 1.3.0'
         
     | 
| 
      
 10 
     | 
    
         
            +
              gem 'i18n', '~> 0.9'
         
     | 
| 
       12 
11 
     | 
    
         
             
            end
         
     | 
| 
       13 
12 
     | 
    
         | 
| 
       14 
13 
     | 
    
         
             
            gemspec
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -3,7 +3,6 @@ 
     | 
|
| 
       3 
3 
     | 
    
         
             
            [](http://badge.fury.io/rb/monetize)
         
     | 
| 
       4 
4 
     | 
    
         
             
            [](https://travis-ci.org/RubyMoney/monetize)
         
     | 
| 
       5 
5 
     | 
    
         
             
            [](https://codeclimate.com/github/RubyMoney/monetize)
         
     | 
| 
       6 
     | 
    
         
            -
            [](https://coveralls.io/r/RubyMoney/monetize)
         
     | 
| 
       7 
6 
     | 
    
         
             
            [](https://gemnasium.com/RubyMoney/monetize)
         
     | 
| 
       8 
7 
     | 
    
         
             
            [](http://opensource.org/licenses/MIT)
         
     | 
| 
       9 
8 
     | 
    
         | 
    
        data/lib/monetize.rb
    CHANGED
    
    | 
         @@ -31,9 +31,9 @@ module Monetize 
     | 
|
| 
       31 
31 
     | 
    
         
             
                  return from_numeric(input, currency) if input.is_a?(Numeric)
         
     | 
| 
       32 
32 
     | 
    
         | 
| 
       33 
33 
     | 
    
         
             
                  parser = Monetize::Parser.new(input, currency, options)
         
     | 
| 
       34 
     | 
    
         
            -
                   
     | 
| 
      
 34 
     | 
    
         
            +
                  amount, currency = parser.parse
         
     | 
| 
       35 
35 
     | 
    
         | 
| 
       36 
     | 
    
         
            -
                  Money. 
     | 
| 
      
 36 
     | 
    
         
            +
                  Money.from_amount(amount, currency)
         
     | 
| 
       37 
37 
     | 
    
         
             
                rescue Money::Currency::UnknownCurrency => e
         
     | 
| 
       38 
38 
     | 
    
         
             
                  fail ParseError, e.message
         
     | 
| 
       39 
39 
     | 
    
         
             
                end
         
     | 
| 
         @@ -43,7 +43,7 @@ module Monetize 
     | 
|
| 
       43 
43 
     | 
    
         
             
                end
         
     | 
| 
       44 
44 
     | 
    
         | 
| 
       45 
45 
     | 
    
         
             
                def from_string(value, currency = Money.default_currency)
         
     | 
| 
       46 
     | 
    
         
            -
                  value = BigDecimal 
     | 
| 
      
 46 
     | 
    
         
            +
                  value = BigDecimal(value.to_s)
         
     | 
| 
       47 
47 
     | 
    
         
             
                  Money.from_amount(value, currency)
         
     | 
| 
       48 
48 
     | 
    
         
             
                end
         
     | 
| 
       49 
49 
     | 
    
         | 
| 
         @@ -66,7 +66,10 @@ module Monetize 
     | 
|
| 
       66 
66 
     | 
    
         
             
                end
         
     | 
| 
       67 
67 
     | 
    
         | 
| 
       68 
68 
     | 
    
         
             
                def extract_cents(input, currency = Money.default_currency)
         
     | 
| 
       69 
     | 
    
         
            -
                  Monetize 
     | 
| 
      
 69 
     | 
    
         
            +
                  warn '[DEPRECATION] Monetize.extract_cents is deprecated. Use Monetize.parse().cents'
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
                  money = parse(input, currency)
         
     | 
| 
      
 72 
     | 
    
         
            +
                  money.cents if money
         
     | 
| 
       70 
73 
     | 
    
         
             
                end
         
     | 
| 
       71 
74 
     | 
    
         
             
              end
         
     | 
| 
       72 
75 
     | 
    
         
             
            end
         
     | 
    
        data/lib/monetize/parser.rb
    CHANGED
    
    | 
         @@ -29,13 +29,17 @@ module Monetize 
     | 
|
| 
       29 
29 
     | 
    
         
             
                MULTIPLIER_SUFFIXES.default = 0
         
     | 
| 
       30 
30 
     | 
    
         
             
                MULTIPLIER_REGEXP = Regexp.new(format('^(.*?\d)(%s)\b([^\d]*)$', MULTIPLIER_SUFFIXES.keys.join('|')), 'i')
         
     | 
| 
       31 
31 
     | 
    
         | 
| 
      
 32 
     | 
    
         
            +
                DEFAULT_DECIMAL_MARK = '.'.freeze
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
       32 
34 
     | 
    
         
             
                def initialize(input, fallback_currency = Money.default_currency, options = {})
         
     | 
| 
       33 
35 
     | 
    
         
             
                  @input = input.to_s.strip
         
     | 
| 
       34 
36 
     | 
    
         
             
                  @fallback_currency = fallback_currency
         
     | 
| 
       35 
37 
     | 
    
         
             
                  @options = options
         
     | 
| 
       36 
38 
     | 
    
         
             
                end
         
     | 
| 
       37 
39 
     | 
    
         | 
| 
       38 
     | 
    
         
            -
                def  
     | 
| 
      
 40 
     | 
    
         
            +
                def parse
         
     | 
| 
      
 41 
     | 
    
         
            +
                  currency = Money::Currency.wrap(parse_currency)
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
       39 
43 
     | 
    
         
             
                  multiplier_exp, input = extract_multiplier
         
     | 
| 
       40 
44 
     | 
    
         | 
| 
       41 
45 
     | 
    
         
             
                  num = input.gsub(/(?:^#{currency.symbol}|[^\d.,'-]+)/, '')
         
     | 
| 
         @@ -46,47 +50,41 @@ module Monetize 
     | 
|
| 
       46 
50 
     | 
    
         | 
| 
       47 
51 
     | 
    
         
             
                  major, minor = extract_major_minor(num, currency)
         
     | 
| 
       48 
52 
     | 
    
         | 
| 
       49 
     | 
    
         
            -
                   
     | 
| 
      
 53 
     | 
    
         
            +
                  amount = BigDecimal([major, minor].join(DEFAULT_DECIMAL_MARK))
         
     | 
| 
      
 54 
     | 
    
         
            +
                  amount = apply_multiplier(multiplier_exp, amount)
         
     | 
| 
      
 55 
     | 
    
         
            +
                  amount = apply_sign(negative, amount)
         
     | 
| 
       50 
56 
     | 
    
         | 
| 
       51 
     | 
    
         
            -
                   
     | 
| 
      
 57 
     | 
    
         
            +
                  [amount, currency]
         
     | 
| 
      
 58 
     | 
    
         
            +
                end
         
     | 
| 
       52 
59 
     | 
    
         | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
      
 60 
     | 
    
         
            +
                private
         
     | 
| 
       54 
61 
     | 
    
         | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
                end
         
     | 
| 
      
 62 
     | 
    
         
            +
                attr_reader :input, :fallback_currency, :options
         
     | 
| 
       57 
63 
     | 
    
         | 
| 
       58 
64 
     | 
    
         
             
                def parse_currency
         
     | 
| 
       59 
65 
     | 
    
         
             
                  computed_currency = nil
         
     | 
| 
       60 
     | 
    
         
            -
                  computed_currency =  
     | 
| 
       61 
     | 
    
         
            -
                  computed_currency ||=  
     | 
| 
      
 66 
     | 
    
         
            +
                  computed_currency = input[/[A-Z]{2,3}/]
         
     | 
| 
      
 67 
     | 
    
         
            +
                  computed_currency ||= compute_currency if assume_from_symbol?
         
     | 
| 
      
 68 
     | 
    
         
            +
             
     | 
| 
       62 
69 
     | 
    
         | 
| 
       63 
70 
     | 
    
         
             
                  computed_currency || fallback_currency || Money.default_currency
         
     | 
| 
       64 
71 
     | 
    
         
             
                end
         
     | 
| 
       65 
72 
     | 
    
         | 
| 
       66 
     | 
    
         
            -
                private
         
     | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
       68 
     | 
    
         
            -
                attr_reader :input, :fallback_currency, :options
         
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
73 
     | 
    
         
             
                def assume_from_symbol?
         
     | 
| 
       71 
74 
     | 
    
         
             
                  options.fetch(:assume_from_symbol) { Monetize.assume_from_symbol }
         
     | 
| 
       72 
75 
     | 
    
         
             
                end
         
     | 
| 
       73 
76 
     | 
    
         | 
| 
       74 
     | 
    
         
            -
                def apply_multiplier(multiplier_exp,  
     | 
| 
       75 
     | 
    
         
            -
                   
     | 
| 
       76 
     | 
    
         
            -
                  minor = minor.to_s + ('0' * multiplier_exp)
         
     | 
| 
       77 
     | 
    
         
            -
                  shift = minor[0...multiplier_exp].to_i
         
     | 
| 
       78 
     | 
    
         
            -
                  major += shift
         
     | 
| 
       79 
     | 
    
         
            -
                  minor = (minor[multiplier_exp..-1] || '')
         
     | 
| 
       80 
     | 
    
         
            -
                  [major, minor]
         
     | 
| 
      
 77 
     | 
    
         
            +
                def apply_multiplier(multiplier_exp, amount)
         
     | 
| 
      
 78 
     | 
    
         
            +
                  amount * 10**multiplier_exp
         
     | 
| 
       81 
79 
     | 
    
         
             
                end
         
     | 
| 
       82 
80 
     | 
    
         | 
| 
       83 
     | 
    
         
            -
                def apply_sign(negative,  
     | 
| 
       84 
     | 
    
         
            -
                  negative ?  
     | 
| 
      
 81 
     | 
    
         
            +
                def apply_sign(negative, amount)
         
     | 
| 
      
 82 
     | 
    
         
            +
                  negative ? amount * -1 : amount
         
     | 
| 
       85 
83 
     | 
    
         
             
                end
         
     | 
| 
       86 
84 
     | 
    
         | 
| 
       87 
85 
     | 
    
         
             
                def compute_currency
         
     | 
| 
       88 
     | 
    
         
            -
                   
     | 
| 
       89 
     | 
    
         
            -
                  CURRENCY_SYMBOLS[ 
     | 
| 
      
 86 
     | 
    
         
            +
                  match = input.match(currency_symbol_regex)
         
     | 
| 
      
 87 
     | 
    
         
            +
                  CURRENCY_SYMBOLS[match.to_s] if match
         
     | 
| 
       90 
88 
     | 
    
         
             
                end
         
     | 
| 
       91 
89 
     | 
    
         | 
| 
       92 
90 
     | 
    
         
             
                def extract_major_minor(num, currency)
         
     | 
| 
         @@ -150,29 +148,13 @@ module Monetize 
     | 
|
| 
       150 
148 
     | 
    
         
             
                  CURRENCY_SYMBOLS.keys.map { |key| Regexp.escape(key) }.join('|')
         
     | 
| 
       151 
149 
     | 
    
         
             
                end
         
     | 
| 
       152 
150 
     | 
    
         | 
| 
       153 
     | 
    
         
            -
                def set_minor_precision(minor, currency)
         
     | 
| 
       154 
     | 
    
         
            -
                  if Money.infinite_precision
         
     | 
| 
       155 
     | 
    
         
            -
                    (BigDecimal.new(minor) / (10**minor.size)) * currency.subunit_to_unit
         
     | 
| 
       156 
     | 
    
         
            -
                  elsif minor.size < currency.decimal_places
         
     | 
| 
       157 
     | 
    
         
            -
                    (minor + ('0' * currency.decimal_places))[0, currency.decimal_places].to_i
         
     | 
| 
       158 
     | 
    
         
            -
                  elsif minor.size > currency.decimal_places
         
     | 
| 
       159 
     | 
    
         
            -
                    if minor[currency.decimal_places, 1].to_i >= 5
         
     | 
| 
       160 
     | 
    
         
            -
                      minor[0, currency.decimal_places].to_i + 1
         
     | 
| 
       161 
     | 
    
         
            -
                    else
         
     | 
| 
       162 
     | 
    
         
            -
                      minor[0, currency.decimal_places].to_i
         
     | 
| 
       163 
     | 
    
         
            -
                    end
         
     | 
| 
       164 
     | 
    
         
            -
                  else
         
     | 
| 
       165 
     | 
    
         
            -
                    minor.to_i
         
     | 
| 
       166 
     | 
    
         
            -
                  end
         
     | 
| 
       167 
     | 
    
         
            -
                end
         
     | 
| 
       168 
     | 
    
         
            -
             
     | 
| 
       169 
151 
     | 
    
         
             
                def split_major_minor(num, delimiter)
         
     | 
| 
       170 
152 
     | 
    
         
             
                  major, minor = num.split(delimiter)
         
     | 
| 
       171 
153 
     | 
    
         
             
                  [major, minor || '00']
         
     | 
| 
       172 
154 
     | 
    
         
             
                end
         
     | 
| 
       173 
155 
     | 
    
         | 
| 
       174 
156 
     | 
    
         
             
                def currency_symbol_regex
         
     | 
| 
       175 
     | 
    
         
            -
                   
     | 
| 
      
 157 
     | 
    
         
            +
                  /(?<![A-Z])(#{regex_safe_symbols})(?![A-Z])/i
         
     | 
| 
       176 
158 
     | 
    
         
             
                end
         
     | 
| 
       177 
159 
     | 
    
         
             
              end
         
     | 
| 
       178 
160 
     | 
    
         
             
            end
         
     | 
    
        data/lib/monetize/version.rb
    CHANGED
    
    
    
        data/monetize.gemspec
    CHANGED
    
    | 
         @@ -7,8 +7,8 @@ require 'English' 
     | 
|
| 
       7 
7 
     | 
    
         
             
            Gem::Specification.new do |spec|
         
     | 
| 
       8 
8 
     | 
    
         
             
              spec.name          = 'monetize'
         
     | 
| 
       9 
9 
     | 
    
         
             
              spec.version       = Monetize::VERSION
         
     | 
| 
       10 
     | 
    
         
            -
              spec.authors       = ['Shane Emmons']
         
     | 
| 
       11 
     | 
    
         
            -
              spec.email         = ['shane@emmons.io']
         
     | 
| 
      
 10 
     | 
    
         
            +
              spec.authors       = ['Shane Emmons', 'Anthony Dmitriyev']
         
     | 
| 
      
 11 
     | 
    
         
            +
              spec.email         = ['shane@emmons.io', 'anthony.dmitriyev@gmail.com']
         
     | 
| 
       12 
12 
     | 
    
         
             
              spec.description   = 'A library for converting various objects into `Money` objects.'
         
     | 
| 
       13 
13 
     | 
    
         
             
              spec.summary       = 'A library for converting various objects into `Money` objects.'
         
     | 
| 
       14 
14 
     | 
    
         
             
              spec.homepage      = 'https://github.com/RubyMoney/monetize'
         
     | 
| 
         @@ -21,7 +21,13 @@ Gem::Specification.new do |spec| 
     | 
|
| 
       21 
21 
     | 
    
         | 
| 
       22 
22 
     | 
    
         
             
              spec.add_dependency 'money', '~> 6.12'
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
              spec.add_development_dependency 'bundler' 
     | 
| 
       25 
     | 
    
         
            -
              spec.add_development_dependency 'rake'
         
     | 
| 
      
 24 
     | 
    
         
            +
              spec.add_development_dependency 'bundler'
         
     | 
| 
      
 25 
     | 
    
         
            +
              spec.add_development_dependency 'rake', '~> 10.2'
         
     | 
| 
       26 
26 
     | 
    
         
             
              spec.add_development_dependency 'rspec', '~> 3.0'
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
              if spec.respond_to?(:metadata)
         
     | 
| 
      
 29 
     | 
    
         
            +
                spec.metadata['changelog_uri'] = 'https://github.com/RubyMoney/monetize/blob/master/CHANGELOG.md'
         
     | 
| 
      
 30 
     | 
    
         
            +
                spec.metadata['source_code_uri'] = 'https://github.com/RubyMoney/monetize/'
         
     | 
| 
      
 31 
     | 
    
         
            +
                spec.metadata['bug_tracker_uri'] = 'https://github.com/RubyMoney/monetize/issues'
         
     | 
| 
      
 32 
     | 
    
         
            +
              end
         
     | 
| 
       27 
33 
     | 
    
         
             
            end
         
     | 
| 
         @@ -7,7 +7,7 @@ require 'monetize/core_extensions' 
     | 
|
| 
       7 
7 
     | 
    
         
             
            describe Monetize, 'core extensions' do
         
     | 
| 
       8 
8 
     | 
    
         
             
              describe NilClass do
         
     | 
| 
       9 
9 
     | 
    
         
             
                describe '#to_money' do
         
     | 
| 
       10 
     | 
    
         
            -
                  it ' 
     | 
| 
      
 10 
     | 
    
         
            +
                  it 'works as documented' do
         
     | 
| 
       11 
11 
     | 
    
         
             
                    money = nil.to_money
         
     | 
| 
       12 
12 
     | 
    
         
             
                    expect(money.cents).to eq 0
         
     | 
| 
       13 
13 
     | 
    
         
             
                    expect(money.currency).to eq Money.default_currency
         
     | 
| 
         @@ -22,7 +22,7 @@ describe Monetize, 'core extensions' do 
     | 
|
| 
       22 
22 
     | 
    
         | 
| 
       23 
23 
     | 
    
         
             
              describe Numeric do
         
     | 
| 
       24 
24 
     | 
    
         
             
                describe '#to_money' do
         
     | 
| 
       25 
     | 
    
         
            -
                  it ' 
     | 
| 
      
 25 
     | 
    
         
            +
                  it 'works as documented' do
         
     | 
| 
       26 
26 
     | 
    
         
             
                    money = 1234.to_money
         
     | 
| 
       27 
27 
     | 
    
         
             
                    expect(money.cents).to eq 1_234_00
         
     | 
| 
       28 
28 
     | 
    
         
             
                    expect(money.currency).to eq Money.default_currency
         
     | 
| 
         @@ -31,7 +31,7 @@ describe Monetize, 'core extensions' do 
     | 
|
| 
       31 
31 
     | 
    
         
             
                    expect(money.cents).to eq 100_37
         
     | 
| 
       32 
32 
     | 
    
         
             
                    expect(money.currency).to eq Money.default_currency
         
     | 
| 
       33 
33 
     | 
    
         | 
| 
       34 
     | 
    
         
            -
                    money = BigDecimal 
     | 
| 
      
 34 
     | 
    
         
            +
                    money = BigDecimal('1234').to_money
         
     | 
| 
       35 
35 
     | 
    
         
             
                    expect(money.cents).to eq 1_234_00
         
     | 
| 
       36 
36 
     | 
    
         
             
                    expect(money.currency).to eq Money.default_currency
         
     | 
| 
       37 
37 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -67,7 +67,8 @@ describe Monetize, 'core extensions' do 
     | 
|
| 
       67 
67 
     | 
    
         
             
                    '-1,000'          => Money.new(-1_000_00),
         
     | 
| 
       68 
68 
     | 
    
         
             
                    '1,000.5'         => Money.new(1_000_50),
         
     | 
| 
       69 
69 
     | 
    
         
             
                    '1,000.51'        => Money.new(1_000_51),
         
     | 
| 
       70 
     | 
    
         
            -
                    '1,000.505'       => Money.new( 
     | 
| 
      
 70 
     | 
    
         
            +
                    '1,000.505'       => Money.new(1_000_50), # ROUND_HALF_EVEN default bankers rounding
         
     | 
| 
      
 71 
     | 
    
         
            +
                    '1,000.515'       => Money.new(1_000_52), # ROUND_HALF_EVEN default bankers rounding
         
     | 
| 
       71 
72 
     | 
    
         
             
                    '1,000.504'       => Money.new(1_000_50),
         
     | 
| 
       72 
73 
     | 
    
         
             
                    '1,000.0000'      => Money.new(1_000_00),
         
     | 
| 
       73 
74 
     | 
    
         
             
                    '1,000.5000'      => Money.new(1_000_50),
         
     | 
| 
         @@ -149,6 +150,28 @@ describe Monetize, 'core extensions' do 
     | 
|
| 
       149 
150 
     | 
    
         
             
                    expect('1'.to_money('JPY')).to eq Money.new(1,     'JPY')
         
     | 
| 
       150 
151 
     | 
    
         
             
                    expect('1.5'.to_money('KWD').cents).to eq 1_500
         
     | 
| 
       151 
152 
     | 
    
         
             
                  end
         
     | 
| 
      
 153 
     | 
    
         
            +
             
     | 
| 
      
 154 
     | 
    
         
            +
                  it 'respects Money.rounding_mode' do
         
     | 
| 
      
 155 
     | 
    
         
            +
                    expect('1.009'.to_money).to eq(Money.new(1_01))
         
     | 
| 
      
 156 
     | 
    
         
            +
             
     | 
| 
      
 157 
     | 
    
         
            +
                    Money.rounding_mode(BigDecimal::ROUND_DOWN) do
         
     | 
| 
      
 158 
     | 
    
         
            +
                      expect('1.009'.to_money).to eq(Money.new(1_00))
         
     | 
| 
      
 159 
     | 
    
         
            +
                    end
         
     | 
| 
      
 160 
     | 
    
         
            +
             
     | 
| 
      
 161 
     | 
    
         
            +
                    expect('1.001'.to_money).to eq(Money.new(1_00))
         
     | 
| 
      
 162 
     | 
    
         
            +
             
     | 
| 
      
 163 
     | 
    
         
            +
                    Money.rounding_mode(BigDecimal::ROUND_UP) do
         
     | 
| 
      
 164 
     | 
    
         
            +
                      expect('1.001'.to_money).to eq(Money.new(1_01))
         
     | 
| 
      
 165 
     | 
    
         
            +
                    end
         
     | 
| 
      
 166 
     | 
    
         
            +
                  end
         
     | 
| 
      
 167 
     | 
    
         
            +
             
     | 
| 
      
 168 
     | 
    
         
            +
                  it 'produces results similar to Money.from_amount for all the rounding edge cases' do
         
     | 
| 
      
 169 
     | 
    
         
            +
                    (1_000..1_010).each do |amount|
         
     | 
| 
      
 170 
     | 
    
         
            +
                      amount = amount.to_f / 1000
         
     | 
| 
      
 171 
     | 
    
         
            +
             
     | 
| 
      
 172 
     | 
    
         
            +
                      expect(amount.to_s.to_money).to eq(Money.from_amount(amount))
         
     | 
| 
      
 173 
     | 
    
         
            +
                    end
         
     | 
| 
      
 174 
     | 
    
         
            +
                  end
         
     | 
| 
       152 
175 
     | 
    
         
             
                end
         
     | 
| 
       153 
176 
     | 
    
         | 
| 
       154 
177 
     | 
    
         
             
                describe '#to_currency' do
         
     | 
    
        data/spec/monetize_spec.rb
    CHANGED
    
    | 
         @@ -70,6 +70,10 @@ describe Monetize do 
     | 
|
| 
       70 
70 
     | 
    
         
             
                          expect(Monetize.parse("#{symbol}#{amount_in_units}")).to eq Money.new(amount, iso_code)
         
     | 
| 
       71 
71 
     | 
    
         
             
                        end
         
     | 
| 
       72 
72 
     | 
    
         | 
| 
      
 73 
     | 
    
         
            +
                        it "parses formatted inputs with #{iso_code} symbol is after the amount" do
         
     | 
| 
      
 74 
     | 
    
         
            +
                          expect(Monetize.parse("#{amount_in_units}#{symbol}")).to eq Money.new(amount, iso_code)
         
     | 
| 
      
 75 
     | 
    
         
            +
                        end
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
       73 
77 
     | 
    
         
             
                        context 'prefix' do
         
     | 
| 
       74 
78 
     | 
    
         
             
                          it 'parses formatted inputs with plus sign and currency as a symbol' do
         
     | 
| 
       75 
79 
     | 
    
         
             
                            expect(Monetize.parse("+#{symbol}#{amount_in_units}")).to eq Money.new(amount, iso_code)
         
     | 
| 
         @@ -114,6 +118,15 @@ describe Monetize do 
     | 
|
| 
       114 
118 
     | 
    
         
             
                      expect(Monetize.parse('L9.99')).to eq Money.new(999, 'USD')
         
     | 
| 
       115 
119 
     | 
    
         
             
                    end
         
     | 
| 
       116 
120 
     | 
    
         | 
| 
      
 121 
     | 
    
         
            +
                    it 'should use provided currency over symbol' do
         
     | 
| 
      
 122 
     | 
    
         
            +
                      expect(Monetize.parse('$1.05 CAD')).to eq Money.new(105, 'CAD')
         
     | 
| 
      
 123 
     | 
    
         
            +
                    end
         
     | 
| 
      
 124 
     | 
    
         
            +
             
     | 
| 
      
 125 
     | 
    
         
            +
                    it 'ignores ZAR symbols that is part of a text' do
         
     | 
| 
      
 126 
     | 
    
         
            +
                      expect(Monetize.parse('EUR 9.99')).to eq Money.new(999, 'EUR')
         
     | 
| 
      
 127 
     | 
    
         
            +
                      expect(Monetize.parse('9.99 EUR')).to eq Money.new(999, 'EUR')
         
     | 
| 
      
 128 
     | 
    
         
            +
                    end
         
     | 
| 
      
 129 
     | 
    
         
            +
             
     | 
| 
       117 
130 
     | 
    
         
             
                    context 'negatives' do
         
     | 
| 
       118 
131 
     | 
    
         
             
                      it 'ignores the ambiguous kr symbol' do
         
     | 
| 
       119 
132 
     | 
    
         
             
                        # Could mean either of DKK, EEK, ISK, NOK, SEK
         
     | 
| 
         @@ -212,6 +225,14 @@ describe Monetize do 
     | 
|
| 
       212 
225 
     | 
    
         
             
                  expect(Monetize.parse('-$5.95-')).to be_nil
         
     | 
| 
       213 
226 
     | 
    
         
             
                end
         
     | 
| 
       214 
227 
     | 
    
         | 
| 
      
 228 
     | 
    
         
            +
                it 'returns nil when more than 2 digit separators are used' do
         
     | 
| 
      
 229 
     | 
    
         
            +
                  expect(Monetize.parse("123.34,56'89 EUR")).to be_nil
         
     | 
| 
      
 230 
     | 
    
         
            +
                end
         
     | 
| 
      
 231 
     | 
    
         
            +
             
     | 
| 
      
 232 
     | 
    
         
            +
                it 'parses correctly strings with repeated digit separator' do
         
     | 
| 
      
 233 
     | 
    
         
            +
                  expect(Monetize.parse('19.12.89', 'EUR')).to eq Money.new(191_289_00, 'EUR')
         
     | 
| 
      
 234 
     | 
    
         
            +
                end
         
     | 
| 
      
 235 
     | 
    
         
            +
             
     | 
| 
       215 
236 
     | 
    
         
             
                it 'parses correctly strings with exactly 3 decimal digits' do
         
     | 
| 
       216 
237 
     | 
    
         
             
                  expect(Monetize.parse('6,534', 'EUR')).to eq Money.new(653, 'EUR')
         
     | 
| 
       217 
238 
     | 
    
         
             
                  expect(Monetize.parse('6.534', 'EUR')).to eq Money.new(653, 'EUR')
         
     | 
| 
         @@ -234,7 +255,7 @@ describe Monetize do 
     | 
|
| 
       234 
255 
     | 
    
         
             
                context 'parsing an instance of Numeric class' do
         
     | 
| 
       235 
256 
     | 
    
         
             
                  let(:integer)     { 10 }
         
     | 
| 
       236 
257 
     | 
    
         
             
                  let(:float)       { 10.0 }
         
     | 
| 
       237 
     | 
    
         
            -
                  let(:big_decimal) { BigDecimal 
     | 
| 
      
 258 
     | 
    
         
            +
                  let(:big_decimal) { BigDecimal('10') }
         
     | 
| 
       238 
259 
     | 
    
         | 
| 
       239 
260 
     | 
    
         
             
                  [:integer, :float, :big_decimal].each do |type|
         
     | 
| 
       240 
261 
     | 
    
         
             
                    it "returns a new Money object based on the #{type} input" do
         
     | 
| 
         @@ -336,6 +357,10 @@ describe Monetize do 
     | 
|
| 
       336 
357 
     | 
    
         
             
                  expect(collection.first).to eq Monetize.parse('$4')
         
     | 
| 
       337 
358 
     | 
    
         
             
                  expect(collection.last).to eq Monetize.parse('$10')
         
     | 
| 
       338 
359 
     | 
    
         
             
                end
         
     | 
| 
      
 360 
     | 
    
         
            +
             
     | 
| 
      
 361 
     | 
    
         
            +
                it 'raises an error if argument is invalid' do
         
     | 
| 
      
 362 
     | 
    
         
            +
                  expect { Monetize.parse_collection(nil) }.to raise_error Monetize::ArgumentError
         
     | 
| 
      
 363 
     | 
    
         
            +
                end
         
     | 
| 
       339 
364 
     | 
    
         
             
              end
         
     | 
| 
       340 
365 
     | 
    
         | 
| 
       341 
366 
     | 
    
         
             
              describe '.from_string' do
         
     | 
| 
         @@ -419,31 +444,31 @@ describe Monetize do 
     | 
|
| 
       419 
444 
     | 
    
         | 
| 
       420 
445 
     | 
    
         
             
              describe '.from_bigdecimal' do
         
     | 
| 
       421 
446 
     | 
    
         
             
                it 'converts given amount to cents' do
         
     | 
| 
       422 
     | 
    
         
            -
                  expect(Monetize.from_bigdecimal(BigDecimal 
     | 
| 
       423 
     | 
    
         
            -
                  expect(Monetize.from_bigdecimal(BigDecimal 
     | 
| 
       424 
     | 
    
         
            -
                  expect(Monetize.from_bigdecimal(BigDecimal 
     | 
| 
      
 447 
     | 
    
         
            +
                  expect(Monetize.from_bigdecimal(BigDecimal('1'))).to eq Money.new(1_00)
         
     | 
| 
      
 448 
     | 
    
         
            +
                  expect(Monetize.from_bigdecimal(BigDecimal('1'))).to eq Money.new(1_00, 'USD')
         
     | 
| 
      
 449 
     | 
    
         
            +
                  expect(Monetize.from_bigdecimal(BigDecimal('1'), 'EUR')).to eq Money.new(1_00, 'EUR')
         
     | 
| 
       425 
450 
     | 
    
         
             
                end
         
     | 
| 
       426 
451 
     | 
    
         | 
| 
       427 
452 
     | 
    
         
             
                it 'respects :subunit_to_unit currency property' do
         
     | 
| 
       428 
     | 
    
         
            -
                  expect(Monetize.from_bigdecimal(BigDecimal 
     | 
| 
       429 
     | 
    
         
            -
                  expect(Monetize.from_bigdecimal(BigDecimal 
     | 
| 
       430 
     | 
    
         
            -
                  expect(Monetize.from_bigdecimal(BigDecimal 
     | 
| 
      
 453 
     | 
    
         
            +
                  expect(Monetize.from_bigdecimal(BigDecimal('1'), 'USD')).to eq Money.new(1_00, 'USD')
         
     | 
| 
      
 454 
     | 
    
         
            +
                  expect(Monetize.from_bigdecimal(BigDecimal('1'), 'TND')).to eq Money.new(1_000, 'TND')
         
     | 
| 
      
 455 
     | 
    
         
            +
                  expect(Monetize.from_bigdecimal(BigDecimal('1'), 'JPY')).to eq Money.new(1, 'JPY')
         
     | 
| 
       431 
456 
     | 
    
         
             
                end
         
     | 
| 
       432 
457 
     | 
    
         | 
| 
       433 
458 
     | 
    
         
             
                it 'respects rounding mode when rounding amount to the nearest cent' do
         
     | 
| 
       434 
     | 
    
         
            -
                  amount = BigDecimal 
     | 
| 
      
 459 
     | 
    
         
            +
                  amount = BigDecimal('1.005')
         
     | 
| 
       435 
460 
     | 
    
         | 
| 
       436 
461 
     | 
    
         
             
                  expect(Monetize.from_bigdecimal(amount, 'USD')).to eq Money.from_amount(amount, 'USD')
         
     | 
| 
       437 
462 
     | 
    
         
             
                end
         
     | 
| 
       438 
463 
     | 
    
         | 
| 
       439 
464 
     | 
    
         
             
                it 'accepts a currency options' do
         
     | 
| 
       440 
     | 
    
         
            -
                  m = Monetize.from_bigdecimal(BigDecimal 
     | 
| 
      
 465 
     | 
    
         
            +
                  m = Monetize.from_bigdecimal(BigDecimal('1'))
         
     | 
| 
       441 
466 
     | 
    
         
             
                  expect(m.currency).to eq Money.default_currency
         
     | 
| 
       442 
467 
     | 
    
         | 
| 
       443 
     | 
    
         
            -
                  m = Monetize.from_bigdecimal(BigDecimal 
     | 
| 
      
 468 
     | 
    
         
            +
                  m = Monetize.from_bigdecimal(BigDecimal('1'), Money::Currency.wrap('EUR'))
         
     | 
| 
       444 
469 
     | 
    
         
             
                  expect(m.currency).to eq Money::Currency.wrap('EUR')
         
     | 
| 
       445 
470 
     | 
    
         | 
| 
       446 
     | 
    
         
            -
                  m = Monetize.from_bigdecimal(BigDecimal 
     | 
| 
      
 471 
     | 
    
         
            +
                  m = Monetize.from_bigdecimal(BigDecimal('1'), 'EUR')
         
     | 
| 
       447 
472 
     | 
    
         
             
                  expect(m.currency).to eq Money::Currency.wrap('EUR')
         
     | 
| 
       448 
473 
     | 
    
         
             
                end
         
     | 
| 
       449 
474 
     | 
    
         | 
| 
         @@ -457,11 +482,11 @@ describe Monetize do 
     | 
|
| 
       457 
482 
     | 
    
         
             
                  end
         
     | 
| 
       458 
483 
     | 
    
         | 
| 
       459 
484 
     | 
    
         
             
                  it 'keeps precision' do
         
     | 
| 
       460 
     | 
    
         
            -
                    expect(Monetize.from_bigdecimal(BigDecimal 
     | 
| 
       461 
     | 
    
         
            -
                    expect(Monetize.from_bigdecimal(BigDecimal 
     | 
| 
       462 
     | 
    
         
            -
                    expect(Monetize.from_bigdecimal(BigDecimal 
     | 
| 
       463 
     | 
    
         
            -
                    expect(Monetize.from_bigdecimal(BigDecimal 
     | 
| 
       464 
     | 
    
         
            -
                    expect(Monetize.from_bigdecimal(BigDecimal 
     | 
| 
      
 485 
     | 
    
         
            +
                    expect(Monetize.from_bigdecimal(BigDecimal('1'))).to eq Money.new(100)
         
     | 
| 
      
 486 
     | 
    
         
            +
                    expect(Monetize.from_bigdecimal(BigDecimal('1.23456'))).to eq Money.new(123.456)
         
     | 
| 
      
 487 
     | 
    
         
            +
                    expect(Monetize.from_bigdecimal(BigDecimal('-1.23456'))).to eq Money.new(-123.456)
         
     | 
| 
      
 488 
     | 
    
         
            +
                    expect(Monetize.from_bigdecimal(BigDecimal('1.23456'))).to eq Money.new(123.456, 'USD')
         
     | 
| 
      
 489 
     | 
    
         
            +
                    expect(Monetize.from_bigdecimal(BigDecimal('1.23456'), 'EUR')).to eq Money.new(123.456, 'EUR')
         
     | 
| 
       465 
490 
     | 
    
         | 
| 
       466 
491 
     | 
    
         
             
                    expect('1'.to_money).to eq Money.new(100)
         
     | 
| 
       467 
492 
     | 
    
         
             
                    expect('1.23456'.to_money).to eq Money.new(123.456)
         
     | 
| 
         @@ -476,7 +501,7 @@ describe Monetize do 
     | 
|
| 
       476 
501 
     | 
    
         
             
                it 'converts given amount to cents' do
         
     | 
| 
       477 
502 
     | 
    
         
             
                  expect(Monetize.from_numeric(1)).to eq Money.new(1_00)
         
     | 
| 
       478 
503 
     | 
    
         
             
                  expect(Monetize.from_numeric(1.0)).to eq Money.new(1_00)
         
     | 
| 
       479 
     | 
    
         
            -
                  expect(Monetize.from_numeric(BigDecimal 
     | 
| 
      
 504 
     | 
    
         
            +
                  expect(Monetize.from_numeric(BigDecimal('1'))).to eq Money.new(1_00)
         
     | 
| 
       480 
505 
     | 
    
         
             
                end
         
     | 
| 
       481 
506 
     | 
    
         | 
| 
       482 
507 
     | 
    
         
             
                it 'raises ArgumentError with unsupported argument' do
         
     | 
| 
         @@ -508,6 +533,20 @@ describe Monetize do 
     | 
|
| 
       508 
533 
     | 
    
         
             
              end
         
     | 
| 
       509 
534 
     | 
    
         | 
| 
       510 
535 
     | 
    
         
             
              describe '.extract_cents' do
         
     | 
| 
      
 536 
     | 
    
         
            +
                it 'is deprecated' do
         
     | 
| 
      
 537 
     | 
    
         
            +
                  allow(Monetize).to receive(:warn)
         
     | 
| 
      
 538 
     | 
    
         
            +
             
     | 
| 
      
 539 
     | 
    
         
            +
                  Monetize.extract_cents('100')
         
     | 
| 
      
 540 
     | 
    
         
            +
             
     | 
| 
      
 541 
     | 
    
         
            +
                  expect(Monetize)
         
     | 
| 
      
 542 
     | 
    
         
            +
                    .to have_received(:warn)
         
     | 
| 
      
 543 
     | 
    
         
            +
                    .with('[DEPRECATION] Monetize.extract_cents is deprecated. Use Monetize.parse().cents')
         
     | 
| 
      
 544 
     | 
    
         
            +
                end
         
     | 
| 
      
 545 
     | 
    
         
            +
             
     | 
| 
      
 546 
     | 
    
         
            +
                it 'extracts cents from a given string' do
         
     | 
| 
      
 547 
     | 
    
         
            +
                  expect(Monetize.extract_cents('10.99')).to eq(1099)
         
     | 
| 
      
 548 
     | 
    
         
            +
                end
         
     | 
| 
      
 549 
     | 
    
         
            +
             
     | 
| 
       511 
550 
     | 
    
         
             
                it "correctly treats pipe marks '|' in input (regression test)" do
         
     | 
| 
       512 
551 
     | 
    
         
             
                  expect(Monetize.extract_cents('100|0')).to eq Monetize.extract_cents('100!0')
         
     | 
| 
       513 
552 
     | 
    
         
             
                end
         
     | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,15 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: monetize
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.10.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Shane Emmons
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
      
 8 
     | 
    
         
            +
            - Anthony Dmitriyev
         
     | 
| 
      
 9 
     | 
    
         
            +
            autorequire:
         
     | 
| 
       9 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2021-01-17 00:00:00.000000000 Z
         
     | 
| 
       12 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
15 
     | 
    
         
             
              name: money
         
     | 
| 
         @@ -28,30 +29,30 @@ dependencies: 
     | 
|
| 
       28 
29 
     | 
    
         
             
              name: bundler
         
     | 
| 
       29 
30 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       30 
31 
     | 
    
         
             
                requirements:
         
     | 
| 
       31 
     | 
    
         
            -
                - - " 
     | 
| 
      
 32 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       32 
33 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       33 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 34 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
       34 
35 
     | 
    
         
             
              type: :development
         
     | 
| 
       35 
36 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       36 
37 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       37 
38 
     | 
    
         
             
                requirements:
         
     | 
| 
       38 
     | 
    
         
            -
                - - " 
     | 
| 
      
 39 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       39 
40 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       40 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 41 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
       41 
42 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       42 
43 
     | 
    
         
             
              name: rake
         
     | 
| 
       43 
44 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       44 
45 
     | 
    
         
             
                requirements:
         
     | 
| 
       45 
     | 
    
         
            -
                - - " 
     | 
| 
      
 46 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       46 
47 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       47 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 48 
     | 
    
         
            +
                    version: '10.2'
         
     | 
| 
       48 
49 
     | 
    
         
             
              type: :development
         
     | 
| 
       49 
50 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       50 
51 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       51 
52 
     | 
    
         
             
                requirements:
         
     | 
| 
       52 
     | 
    
         
            -
                - - " 
     | 
| 
      
 53 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       53 
54 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       54 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 55 
     | 
    
         
            +
                    version: '10.2'
         
     | 
| 
       55 
56 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       56 
57 
     | 
    
         
             
              name: rspec
         
     | 
| 
       57 
58 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -69,14 +70,14 @@ dependencies: 
     | 
|
| 
       69 
70 
     | 
    
         
             
            description: A library for converting various objects into `Money` objects.
         
     | 
| 
       70 
71 
     | 
    
         
             
            email:
         
     | 
| 
       71 
72 
     | 
    
         
             
            - shane@emmons.io
         
     | 
| 
      
 73 
     | 
    
         
            +
            - anthony.dmitriyev@gmail.com
         
     | 
| 
       72 
74 
     | 
    
         
             
            executables: []
         
     | 
| 
       73 
75 
     | 
    
         
             
            extensions: []
         
     | 
| 
       74 
76 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       75 
77 
     | 
    
         
             
            files:
         
     | 
| 
       76 
     | 
    
         
            -
            - ". 
     | 
| 
      
 78 
     | 
    
         
            +
            - ".github/workflows/ruby.yml"
         
     | 
| 
       77 
79 
     | 
    
         
             
            - ".gitignore"
         
     | 
| 
       78 
80 
     | 
    
         
             
            - ".rubocop.yml"
         
     | 
| 
       79 
     | 
    
         
            -
            - ".travis.yml"
         
     | 
| 
       80 
81 
     | 
    
         
             
            - CHANGELOG.md
         
     | 
| 
       81 
82 
     | 
    
         
             
            - CONTRIBUTING.md
         
     | 
| 
       82 
83 
     | 
    
         
             
            - Gemfile
         
     | 
| 
         @@ -101,8 +102,11 @@ files: 
     | 
|
| 
       101 
102 
     | 
    
         
             
            homepage: https://github.com/RubyMoney/monetize
         
     | 
| 
       102 
103 
     | 
    
         
             
            licenses:
         
     | 
| 
       103 
104 
     | 
    
         
             
            - MIT
         
     | 
| 
       104 
     | 
    
         
            -
            metadata: 
     | 
| 
       105 
     | 
    
         
            -
             
     | 
| 
      
 105 
     | 
    
         
            +
            metadata:
         
     | 
| 
      
 106 
     | 
    
         
            +
              changelog_uri: https://github.com/RubyMoney/monetize/blob/master/CHANGELOG.md
         
     | 
| 
      
 107 
     | 
    
         
            +
              source_code_uri: https://github.com/RubyMoney/monetize/
         
     | 
| 
      
 108 
     | 
    
         
            +
              bug_tracker_uri: https://github.com/RubyMoney/monetize/issues
         
     | 
| 
      
 109 
     | 
    
         
            +
            post_install_message:
         
     | 
| 
       106 
110 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       107 
111 
     | 
    
         
             
            require_paths:
         
     | 
| 
       108 
112 
     | 
    
         
             
            - lib
         
     | 
| 
         @@ -117,9 +121,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       117 
121 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       118 
122 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       119 
123 
     | 
    
         
             
            requirements: []
         
     | 
| 
       120 
     | 
    
         
            -
             
     | 
| 
       121 
     | 
    
         
            -
             
     | 
| 
       122 
     | 
    
         
            -
            signing_key: 
         
     | 
| 
      
 124 
     | 
    
         
            +
            rubygems_version: 3.0.3
         
     | 
| 
      
 125 
     | 
    
         
            +
            signing_key:
         
     | 
| 
       123 
126 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       124 
127 
     | 
    
         
             
            summary: A library for converting various objects into `Money` objects.
         
     | 
| 
       125 
128 
     | 
    
         
             
            test_files:
         
     | 
    
        data/.coveralls.yml
    DELETED
    
    | 
         @@ -1 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            repo_token: pbKErt5rAW1iRYGMIAGGAAHfVRmiBzxfd
         
     |