currency_select 2.0.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0517d3f18d5cdba188efed20ecad2a2b386ca93311469b2852588cc2a6b5b1cd
4
- data.tar.gz: b8749dc246a0bde1ad45f9ff3319798fd22e35502a363ed77da766966b4becdb
3
+ metadata.gz: 604aa2ae65152c8cee328a9057730d2c0b13a837821011c4243abe5472e5ddfd
4
+ data.tar.gz: 875ac451d6891e673b4c5de1be1d3da37332d86d8144a00cc6f4685cdf16c44d
5
5
  SHA512:
6
- metadata.gz: 2ed63a3fa3a5a8646b0e55914e6180c89d854fc34c219b68b58a832c387e33407b3fc3cf1934ebbb7b6b4b9fa6f34e7c4e7c07a91dca287a2066b1b41eb05026
7
- data.tar.gz: afafe32396e486175f6ceb569ce302a9b407ae917df36b31e0b6f3efcabcb00b418733c396b1922a9290805021618ef816c080529c59a7a1758dcc43f001d6db
6
+ metadata.gz: ddd165f48539bcfbaf4beab11d8e1863de607466de249a7e098e005e53ec3e14dba8aeb0fa9a6040ab8fd92986020d603642145712cfe87523edd7488944a6f0
7
+ data.tar.gz: 7a940a412651e7a8dd0fd147b118780e2c891fdc97e451c5757c43447f2d63ef6343489989dd7e4ae2943482118d76bef4eab143530bb8ac54f700e7ff2ae900
@@ -17,6 +17,28 @@ This project adheres to [Semantic Versioning](https://semver.org/).
17
17
 
18
18
  ### Security
19
19
 
20
+ ## 3.0.0
21
+
22
+ ### Added
23
+ - Add automatic gem release (#86, #88)
24
+ - Support Ruby 3 (#81)
25
+ - Add support for Rails 6.1 (#78, #79, #83)
26
+ - Check the code with RuboCop (#72)
27
+ - Add support for Ruby 2.7 (#66)
28
+
29
+ ### Changed
30
+ - Switch the CI from Travis to GitHub Actions (#80, #85)
31
+ - Upgrade RSpec and RSpec-Rails (#71)
32
+ - Update the Ruby versions on Travis CI (#68)
33
+
34
+ ### Removed
35
+ - Drop support for Ruby 2.4 (#70)
36
+ - Drop support for Rails < 5.2 (#65)
37
+
38
+ ### Fixed
39
+ - Fix some RuboCop warnings (#73)
40
+ - Fix warnings in the `.travis.yml` (#67, #69)
41
+
20
42
  ## 2.0.0
21
43
 
22
44
  ### Added
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # CurrencySelect
2
2
 
3
- [![Build Status](https://travis-ci.org/braingourmets/currency_select.svg?branch=master)](https://travis-ci.org/braingourmets/currency_select)
3
+ [![GitHub CI Status](https://github.com/braingourmets/currency_select/workflows/CI/badge.svg?branch=main)](https://github.com/braingourmets/currency_select/actions)
4
4
  [![Gem Version](https://badge.fury.io/rb/currency_select.svg)](http://badge.fury.io/rb/currency_select)
5
5
 
6
6
  Adds a currency_select helper to Ruby on Rails projects, allowing you to get
data/Rakefile CHANGED
@@ -12,3 +12,8 @@ Rake::RDocTask.new do |rdoc|
12
12
  rdoc.rdoc_files.include('README.md')
13
13
  rdoc.rdoc_files.include('lib/**/*.rb')
14
14
  end
15
+
16
+ desc 'Runs RuboCop for checking the Ruby files.'
17
+ task :rubocop do
18
+ sh 'rubocop lib/ rails/ spec/ currency_select.gemspec Gemfile Rakefile'
19
+ end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.0
1
+ 3.0.0
@@ -8,17 +8,23 @@ Gem::Specification.new do |s|
8
8
  s.version = version
9
9
  s.license = 'MIT'
10
10
 
11
- s.required_ruby_version = '>= 2.4.0'
11
+ s.required_ruby_version = '>= 2.5.0'
12
12
 
13
13
  s.homepage = 'https://github.com/braingourmets/currency_select'
14
14
  s.authors = ['Trond Arve Nordheim', 'Oliver Klee']
15
15
  s.email = 'o.klee@braingourmets.com'
16
16
 
17
- s.files = %w[lib/currency_select.rb rails/init.rb CHANGELOG.md CODE_OF_CONDUCT.md currency_select.gemspec Gemfile LICENSE Rakefile README.md VERSION]
17
+ s.files = %w[
18
+ lib/currency_select.rb rails/init.rb CHANGELOG.md CODE_OF_CONDUCT.md
19
+ currency_select.gemspec Gemfile LICENSE Rakefile README.md VERSION
20
+ ]
18
21
  s.extra_rdoc_files = %w[CHANGELOG.md LICENSE README.md]
19
22
 
20
- s.add_runtime_dependency 'actionview', '>= 5.1.0', '< 6.1'
23
+ s.add_runtime_dependency 'actionview', '>= 5.2.0', '< 6.2'
21
24
  s.add_runtime_dependency 'money', '~> 6.0'
22
25
 
23
- s.add_development_dependency 'rspec-rails', '~> 3.8.2'
26
+ s.add_development_dependency 'rspec-rails', '~> 4.0.0'
27
+ s.add_development_dependency 'rubocop', '~> 0.82.0'
28
+ s.add_development_dependency 'rubocop-rails', '~> 2.5.2'
29
+ s.add_development_dependency 'rubocop-rspec', '~> 1.38.1'
24
30
  end
@@ -2,6 +2,9 @@
2
2
 
3
3
  require 'money'
4
4
 
5
+ ##
6
+ # Module for creating currency drop-downs.
7
+ #
5
8
  module CurrencySelect
6
9
  class << self
7
10
  ##
@@ -10,7 +13,7 @@ module CurrencySelect
10
13
  # priority: 2,
11
14
  # iso_code: "EUR",
12
15
  # name: "Euro",
13
- # symbol: "",
16
+ # symbol: "$",
14
17
  # alternate_symbols: [],
15
18
  # subunit: "Cent",
16
19
  # subunit_to_unit: 100,
@@ -50,12 +53,17 @@ module CurrencySelect
50
53
  # passed as an argument
51
54
  # == Example
52
55
  # priority_currencies_array([ "USD", "NOK" ])
53
- # # => [ ['United States Dollar - USD', 'USD' ], ['Norwegian Kroner - NOK', 'NOK'] ]
56
+ # # => [
57
+ # # ['United States Dollar - USD', 'USD' ],
58
+ # # ['Norwegian Kroner - NOK', 'NOK']
59
+ # # ]
54
60
  #
55
61
  # @return [Array]
56
62
  #
57
63
  def priority_currencies_array(currency_codes = [])
58
- currency_codes.flat_map { |code| currencies_array.select { |currency| currency.last.to_s == code } }
64
+ currency_codes.flat_map do |code|
65
+ currencies_array.select { |currency| currency.last.to_s == code }
66
+ end
59
67
  end
60
68
  end
61
69
  end
@@ -63,10 +71,16 @@ end
63
71
  # CurrencySelect
64
72
  module ActionView
65
73
  module Helpers
74
+ ##
75
+ # Module for the form options.
76
+ #
66
77
  module FormOptionsHelper
67
78
  # Return select and option tags for the given object and method, using
68
79
  # currency_options_for_select to generate the list of option tags.
69
- def currency_select(object, method, priority_currencies = nil, options = {}, html_options = {})
80
+ def currency_select(
81
+ object, method, priority_currencies = nil, options = {},
82
+ html_options = {}
83
+ )
70
84
  tag = CurrencySelectTag.new(object, method, self, options)
71
85
  tag.to_currency_select_tag(priority_currencies, options, html_options)
72
86
  end
@@ -80,8 +94,12 @@ module ActionView
80
94
  currency_options = ''.html_safe
81
95
 
82
96
  if priority_currencies
83
- currency_options += options_for_select(::CurrencySelect.priority_currencies_array(priority_currencies), selected)
84
- currency_options += "<option value=\"\" disabled=\"disabled\">-------------</option>\n".html_safe
97
+ currency_options += options_for_select(
98
+ ::CurrencySelect.priority_currencies_array(priority_currencies),
99
+ selected
100
+ )
101
+ raw = '<option value="" disabled="disabled">-------------</option>'
102
+ currency_options += raw.html_safe + "\n"
85
103
 
86
104
  # prevents selected from being included twice in the HTML which causes
87
105
  # some browsers to select the second selected option (not priority)
@@ -90,30 +108,57 @@ module ActionView
90
108
  end
91
109
 
92
110
  # All the countries included in the country_options output.
93
- currency_options + options_for_select(::CurrencySelect.currencies_array, selected)
111
+ currency_options + options_for_select(
112
+ ::CurrencySelect.currencies_array, selected
113
+ )
94
114
  end
95
115
  end
96
116
 
117
+ ##
118
+ # Tag.
119
+ #
97
120
  module ToCurrencySelectTag
98
121
  def to_currency_select_tag(priority_currencies, options, html_options)
99
122
  html_options = html_options.stringify_keys
100
123
  add_default_name_and_id(html_options)
101
- value = if method(:value).arity == 0
124
+ value = if method(:value).arity.zero?
102
125
  value()
103
126
  else
104
127
  value(object)
105
128
  end
106
- content_tag('select', add_options(currency_options_for_select(value, priority_currencies), options, value), html_options)
129
+ content_tag(
130
+ 'select',
131
+ add_options(
132
+ currency_options_for_select(value, priority_currencies),
133
+ options,
134
+ value
135
+ ),
136
+ html_options
137
+ )
107
138
  end
108
139
  end
109
140
 
141
+ ##
142
+ # Tag.
143
+ #
110
144
  class CurrencySelectTag < Tags::Base
111
145
  include ToCurrencySelectTag
112
146
  end
113
147
 
148
+ ##
149
+ # Form builder.
150
+ #
114
151
  class FormBuilder
115
- def currency_select(method, priority_currencies = nil, options = {}, html_options = {})
116
- @template.currency_select(@object_name, method, priority_currencies, options.merge(object: @object), html_options)
152
+ def currency_select(
153
+ method, priority_currencies = nil, options = {}, html_options = {}
154
+ )
155
+ @template.currency_select(
156
+ @object_name,
157
+ method,
158
+ priority_currencies,
159
+ options.merge(object: @object),
160
+ html_options
161
+ )
117
162
  end
118
163
  end
119
164
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: currency_select
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Trond Arve Nordheim
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-09-02 00:00:00.000000000 Z
12
+ date: 2021-01-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionview
@@ -17,20 +17,20 @@ dependencies:
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: 5.1.0
20
+ version: 5.2.0
21
21
  - - "<"
22
22
  - !ruby/object:Gem::Version
23
- version: '6.1'
23
+ version: '6.2'
24
24
  type: :runtime
25
25
  prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
27
27
  requirements:
28
28
  - - ">="
29
29
  - !ruby/object:Gem::Version
30
- version: 5.1.0
30
+ version: 5.2.0
31
31
  - - "<"
32
32
  - !ruby/object:Gem::Version
33
- version: '6.1'
33
+ version: '6.2'
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: money
36
36
  requirement: !ruby/object:Gem::Requirement
@@ -51,14 +51,56 @@ dependencies:
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 3.8.2
54
+ version: 4.0.0
55
55
  type: :development
56
56
  prerelease: false
57
57
  version_requirements: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 3.8.2
61
+ version: 4.0.0
62
+ - !ruby/object:Gem::Dependency
63
+ name: rubocop
64
+ requirement: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.82.0
69
+ type: :development
70
+ prerelease: false
71
+ version_requirements: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.82.0
76
+ - !ruby/object:Gem::Dependency
77
+ name: rubocop-rails
78
+ requirement: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 2.5.2
83
+ type: :development
84
+ prerelease: false
85
+ version_requirements: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 2.5.2
90
+ - !ruby/object:Gem::Dependency
91
+ name: rubocop-rspec
92
+ requirement: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 1.38.1
97
+ type: :development
98
+ prerelease: false
99
+ version_requirements: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 1.38.1
62
104
  description:
63
105
  email: o.klee@braingourmets.com
64
106
  executables: []
@@ -90,14 +132,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
90
132
  requirements:
91
133
  - - ">="
92
134
  - !ruby/object:Gem::Version
93
- version: 2.4.0
135
+ version: 2.5.0
94
136
  required_rubygems_version: !ruby/object:Gem::Requirement
95
137
  requirements:
96
138
  - - ">="
97
139
  - !ruby/object:Gem::Version
98
140
  version: '0'
99
141
  requirements: []
100
- rubygems_version: 3.0.6
142
+ rubygems_version: 3.2.3
101
143
  signing_key:
102
144
  specification_version: 4
103
145
  summary: Currency select plugin for Rails