currency_select 2.0.0 → 4.1.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: 34966f5e01826eea10afd72d0482a6b206086c84ae9c1b3daff05abfb71b5e0c
4
+ data.tar.gz: 9848694b180fe61281b0f042560c606d1a4f0b13140b3f18311f6f7162ac1ced
5
5
  SHA512:
6
- metadata.gz: 2ed63a3fa3a5a8646b0e55914e6180c89d854fc34c219b68b58a832c387e33407b3fc3cf1934ebbb7b6b4b9fa6f34e7c4e7c07a91dca287a2066b1b41eb05026
7
- data.tar.gz: afafe32396e486175f6ceb569ce302a9b407ae917df36b31e0b6f3efcabcb00b418733c396b1922a9290805021618ef816c080529c59a7a1758dcc43f001d6db
6
+ metadata.gz: 542ce884664c90151e0fe52bdd81e12175b51b444784d8c30c1aabd645f2bb2b607b2ae2532b4fafde242bb021cd1aae6b83dc2723ea933a885d1cb6027698d1
7
+ data.tar.gz: 40fd4238f223fb9b6d045744c777cc8b4fabfadf2179e85b22cc160d90811a6a0ec89a4d36c5ada145db503465d693466d166811b77bcc507d0b4612c82446af
data/CHANGELOG.md CHANGED
@@ -17,6 +17,41 @@ This project adheres to [Semantic Versioning](https://semver.org/).
17
17
 
18
18
  ### Security
19
19
 
20
+ ## 4.1.0
21
+
22
+ ### Added
23
+ - Add support for Ruby 3.1 (#105)
24
+
25
+ ## 4.0.0
26
+
27
+ ### Added
28
+ - Add support for Rails 7.0 (#96)
29
+
30
+ ### Removed
31
+ - Drop support for Ruby 2.5 (#90)
32
+
33
+ ## 3.0.0
34
+
35
+ ### Added
36
+ - Add automatic gem release (#86, #88)
37
+ - Support Ruby 3 (#81)
38
+ - Add support for Rails 6.1 (#78, #79, #83)
39
+ - Check the code with RuboCop (#72)
40
+ - Add support for Ruby 2.7 (#66)
41
+
42
+ ### Changed
43
+ - Switch the CI from Travis to GitHub Actions (#80, #85)
44
+ - Upgrade RSpec and RSpec-Rails (#71)
45
+ - Update the Ruby versions on Travis CI (#68)
46
+
47
+ ### Removed
48
+ - Drop support for Ruby 2.4 (#70)
49
+ - Drop support for Rails < 5.2 (#65)
50
+
51
+ ### Fixed
52
+ - Fix some RuboCop warnings (#73)
53
+ - Fix warnings in the `.travis.yml` (#67, #69)
54
+
20
55
  ## 2.0.0
21
56
 
22
57
  ### 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
+ 4.1.0
@@ -8,17 +8,24 @@ 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.6.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', '< 7.1'
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', '~> 5.1.0'
27
+ s.add_development_dependency 'rubocop', '~> 1.25.1'
28
+ s.add_development_dependency 'rubocop-rails', '~> 2.13.2'
29
+ s.add_development_dependency 'rubocop-rake', '~> 0.6.0'
30
+ s.add_development_dependency 'rubocop-rspec', '~> 2.8.0'
24
31
  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: 4.1.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: 2022-02-25 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: '7.1'
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: '7.1'
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: money
36
36
  requirement: !ruby/object:Gem::Requirement
@@ -51,14 +51,70 @@ dependencies:
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 3.8.2
54
+ version: 5.1.0
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 5.1.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: 1.25.1
69
+ type: :development
70
+ prerelease: false
71
+ version_requirements: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 1.25.1
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.13.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.13.2
90
+ - !ruby/object:Gem::Dependency
91
+ name: rubocop-rake
92
+ requirement: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.6.0
97
+ type: :development
98
+ prerelease: false
99
+ version_requirements: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 0.6.0
104
+ - !ruby/object:Gem::Dependency
105
+ name: rubocop-rspec
106
+ requirement: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 2.8.0
55
111
  type: :development
56
112
  prerelease: false
57
113
  version_requirements: !ruby/object:Gem::Requirement
58
114
  requirements:
59
115
  - - "~>"
60
116
  - !ruby/object:Gem::Version
61
- version: 3.8.2
117
+ version: 2.8.0
62
118
  description:
63
119
  email: o.klee@braingourmets.com
64
120
  executables: []
@@ -90,14 +146,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
90
146
  requirements:
91
147
  - - ">="
92
148
  - !ruby/object:Gem::Version
93
- version: 2.4.0
149
+ version: 2.6.0
94
150
  required_rubygems_version: !ruby/object:Gem::Requirement
95
151
  requirements:
96
152
  - - ">="
97
153
  - !ruby/object:Gem::Version
98
154
  version: '0'
99
155
  requirements: []
100
- rubygems_version: 3.0.6
156
+ rubygems_version: 3.3.7
101
157
  signing_key:
102
158
  specification_version: 4
103
159
  summary: Currency select plugin for Rails