monetize 1.9.4 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6268692fea7908fbc268790bf98cca9795df28eed380b07d2683eed6f5dad4d1
4
- data.tar.gz: 8d795add425b915dc88ecf910505af69b7c1f340ae412083e4c230f0622c2e27
3
+ metadata.gz: 63f57158028647c2bde5bac4c2186e16e9a3874d6c6d756b08e091d1357fcfcc
4
+ data.tar.gz: 5dd093ceef480ffd21fbfaa3a0912cdc7421f797c4570a2a8bde9665534aa6ff
5
5
  SHA512:
6
- metadata.gz: e4291ebf0a43a4bea5a2973186b1dca2d9d9fa08729acb956073efb2628d6898620f5eb1110ade3bba5dbac313894babd4ab59c0d1db92b8cb8e041974a0d402
7
- data.tar.gz: 06d080183a460c5777b9f7443655bcb00d214ee18a6294f0838a3ac4bfec95715ab1ad5704001d286a6bc1ed0966a4a031942bd946ef9d249372ea527a120785
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
@@ -15,3 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ .ruby-version
@@ -1,5 +1,8 @@
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
+
3
6
  ## 1.9.4
4
7
  - Fix symbol parsing that are surrounded by other characters
5
8
 
data/Gemfile CHANGED
@@ -1,7 +1,5 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'coveralls', '>= 0.8.20', require: false
4
-
5
3
  # JSON and I18n gem no longer supports ruby < 2.0.0
6
4
  if defined?(JRUBY_VERSION)
7
5
  gem 'json'
data/README.md CHANGED
@@ -3,7 +3,6 @@
3
3
  [![Gem Version](https://badge.fury.io/rb/monetize.svg)](http://badge.fury.io/rb/monetize)
4
4
  [![Build Status](https://travis-ci.org/RubyMoney/monetize.svg?branch=master)](https://travis-ci.org/RubyMoney/monetize)
5
5
  [![Code Climate](https://codeclimate.com/github/RubyMoney/monetize.svg)](https://codeclimate.com/github/RubyMoney/monetize)
6
- [![Coverage Status](https://coveralls.io/repos/RubyMoney/monetize/badge.svg)](https://coveralls.io/r/RubyMoney/monetize)
7
6
  [![Dependency Status](https://gemnasium.com/RubyMoney/monetize.svg)](https://gemnasium.com/RubyMoney/monetize)
8
7
  [![License](https://img.shields.io/badge/license-MIT-green.svg)](http://opensource.org/licenses/MIT)
9
8
 
@@ -63,8 +63,9 @@ module Monetize
63
63
 
64
64
  def parse_currency
65
65
  computed_currency = nil
66
- computed_currency = compute_currency if assume_from_symbol?
67
- computed_currency ||= input[/[A-Z]{2,3}/]
66
+ computed_currency = input[/[A-Z]{2,3}/]
67
+ computed_currency ||= compute_currency if assume_from_symbol?
68
+
68
69
 
69
70
  computed_currency || fallback_currency || Money.default_currency
70
71
  end
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Monetize
4
- VERSION = '1.9.4'
4
+ VERSION = '1.10.0'
5
5
  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 'work as documented' do
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 'work as documented' do
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
@@ -118,6 +118,10 @@ describe Monetize do
118
118
  expect(Monetize.parse('L9.99')).to eq Money.new(999, 'USD')
119
119
  end
120
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
+
121
125
  it 'ignores ZAR symbols that is part of a text' do
122
126
  expect(Monetize.parse('EUR 9.99')).to eq Money.new(999, 'EUR')
123
127
  expect(Monetize.parse('9.99 EUR')).to eq Money.new(999, 'EUR')
@@ -1,6 +1,4 @@
1
1
  # encoding: utf-8
2
- require 'coveralls'
3
- Coveralls.wear!
4
2
 
5
3
  require 'money'
6
4
 
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: monetize
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.4
4
+ version: 1.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shane Emmons
8
8
  - Anthony Dmitriyev
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-01-07 00:00:00.000000000 Z
12
+ date: 2021-01-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: money
@@ -75,10 +75,9 @@ executables: []
75
75
  extensions: []
76
76
  extra_rdoc_files: []
77
77
  files:
78
- - ".coveralls.yml"
78
+ - ".github/workflows/ruby.yml"
79
79
  - ".gitignore"
80
80
  - ".rubocop.yml"
81
- - ".travis.yml"
82
81
  - CHANGELOG.md
83
82
  - CONTRIBUTING.md
84
83
  - Gemfile
@@ -107,7 +106,7 @@ metadata:
107
106
  changelog_uri: https://github.com/RubyMoney/monetize/blob/master/CHANGELOG.md
108
107
  source_code_uri: https://github.com/RubyMoney/monetize/
109
108
  bug_tracker_uri: https://github.com/RubyMoney/monetize/issues
110
- post_install_message:
109
+ post_install_message:
111
110
  rdoc_options: []
112
111
  require_paths:
113
112
  - lib
@@ -123,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
122
  version: '0'
124
123
  requirements: []
125
124
  rubygems_version: 3.0.3
126
- signing_key:
125
+ signing_key:
127
126
  specification_version: 4
128
127
  summary: A library for converting various objects into `Money` objects.
129
128
  test_files:
@@ -1 +0,0 @@
1
- repo_token: pbKErt5rAW1iRYGMIAGGAAHfVRmiBzxfd
@@ -1,21 +0,0 @@
1
- sudo: false
2
- language:
3
- - ruby
4
- - java
5
- rvm:
6
- - 1.9.3
7
- - 2.0.0
8
- - 2.1.10
9
- - 2.2.10
10
- - 2.3.8
11
- - 2.4.6
12
- - 2.5.5
13
- - 2.6.3
14
- - jruby-9.0.5.0
15
- jdk: openjdk8
16
- before_install:
17
- - gem install bundler --version '~> 1.17'
18
- script: bundle exec rspec spec
19
- notifications:
20
- recipients:
21
- - shane@emmons.io