currency_select 0.1.5 → 0.2.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
- SHA1:
3
- metadata.gz: 6b9b941851e10ef31425af48bafb08196b7389f5
4
- data.tar.gz: 0d67fa20e92859ffcb84fff09d20f5322756fdbb
2
+ SHA256:
3
+ metadata.gz: e2471dfa3ccebc2db85ee1a7a2a00056b316b5d7241f405db0b47e6f3fa83913
4
+ data.tar.gz: b3808c9060bfeb3fd083abfebdd76ab0e6d9d4c5257b8310459bad7bf0785eb6
5
5
  SHA512:
6
- metadata.gz: 83a415abda8afb50de6f119596d50f2e564f5289334f4066a42d788a5b2b02985cc62a7b90c525824ec79373febb5d16e0f20a500b2bf34d09c6ecbd5a6201c8
7
- data.tar.gz: 8e852040bf40eec82ced27f0ee9a2370d4e30e6eb5d3234e76d2dee07890a0389412a594d10485472ef5c46812fdd93f70175459db190b1cbf41e6b62bdac85c
6
+ metadata.gz: b30f41b0297a3f473827b3c6e0ba80a7cfc9b990225cf2dfe011f2ab5d2a4d377ddfb06fd9f12cc5a5d6cec661dd9160a120192dbeee168f430da1fb3402d3ed
7
+ data.tar.gz: f10c333fc00853130c1ac70545f2213898a478eb843c174a0d2edee51568ec31ea79bf27099e462394df94fab7fc73da5869d2a426650c58107b3f00756d03b9
data/CHANGELOG.md ADDED
@@ -0,0 +1,66 @@
1
+ # currency_select change log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ This project adheres to [Semantic Versioning](http://semver.org/).
5
+
6
+
7
+ ## x.y.z (unreleased)
8
+
9
+ ### Added
10
+
11
+
12
+ ### Changed
13
+
14
+
15
+ ### Deprecated
16
+
17
+
18
+ ### Removed
19
+
20
+
21
+ ### Fixed
22
+
23
+
24
+ ### Security
25
+
26
+
27
+
28
+ ## 0.2.0
29
+
30
+ ### Added
31
+ - Automatically use the version number from the VERSION file in the gemspec
32
+ ([#32](https://github.com/braingourmets/currency_select/pull/32))
33
+ - Add a code of conduct
34
+ ([#25](https://github.com/braingourmets/currency_select/pull/25))
35
+
36
+
37
+ ### Changed
38
+ - Mark all Ruby files as frozen_string_literal: true
39
+ ([#31](https://github.com/braingourmets/currency_select/pull/31))
40
+
41
+
42
+ ### Deprecated
43
+ - Support for Rails < 5.0.0 will be removed in version 2.0.0.
44
+ - Support for Rails < 4.2.0 will be removed in version 1.0.0.
45
+ - Support for Ruby < 2.2.2 will be removed in version 2.0.0.
46
+ - Support for Ruby < 2.0.0 will be removed in version 1.0.0.
47
+
48
+
49
+ ### Removed
50
+ - Remove pre-Rails-4.0-specific code
51
+ ([#38](https://github.com/braingourmets/currency_select/pull/38))
52
+ - Drop Jeweler
53
+ ([#28](https://github.com/braingourmets/currency_select/pull/28))
54
+
55
+
56
+ ### Fixed
57
+ - Add ActionView as explicit dependency
58
+ ([#34](https://github.com/braingourmets/currency_select/pull/34))
59
+ - Fix the check for only one active selection in the specs
60
+ ([#27](https://github.com/braingourmets/currency_select/pull/27))
61
+ - Use ISO codes as select values, not the IDs
62
+ ([#24](https://github.com/braingourmets/currency_select/pull/24))
63
+ - Fix the the Gemfile
64
+ ([#19](https://github.com/braingourmets/currency_select/pull/19))
65
+ - Fix the order of name attribute and ID in the specs
66
+ ([#18](https://github.com/braingourmets/currency_select/pull/18))
@@ -0,0 +1,77 @@
1
+ # Contributor Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age,
8
+ body size, disability, ethnicity, gender identity and expression, level of
9
+ experience, nationality, personal appearance, race, religion, or sexual
10
+ identity and orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+
35
+ ## Our Responsibilities
36
+
37
+ Project maintainers are responsible for clarifying the standards of acceptable
38
+ behavior and are expected to take appropriate and fair corrective action in
39
+ response to any instances of unacceptable behavior.
40
+
41
+ Project maintainers have the right and responsibility to remove, edit, or
42
+ reject comments, commits, code, wiki edits, issues, and other contributions
43
+ that are not aligned to this Code of Conduct, or to ban temporarily or
44
+ permanently any contributor for other behaviors that they deem inappropriate,
45
+ threatening, offensive, or harmful.
46
+
47
+ ## Scope
48
+
49
+ This Code of Conduct applies both within project spaces and in public spaces
50
+ when an individual is representing the project or its community. Examples of
51
+ representing a project or community include using an official project e-mail
52
+ address, posting via an official social media account, or acting as an
53
+ appointed representative at an online or offline event. Representation of a
54
+ project may be further defined and clarified by project maintainers.
55
+
56
+ ## Enforcement
57
+
58
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
59
+ reported by contacting the project team at (info at braingourmets dot com).
60
+ All complaints will be reviewed and investigated and will result in a response
61
+ that is deemed necessary and appropriate to the circumstances. The project team
62
+ is obligated to maintain confidentiality with regard to the reporter of an
63
+ incident. Further details of specific enforcement policies may be posted
64
+ separately.
65
+
66
+ Project maintainers who do not follow or enforce the Code of Conduct in good
67
+ faith may face temporary or permanent repercussions as determined by other
68
+ members of the project's leadership.
69
+
70
+ ## Attribution
71
+
72
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
73
+ version 1.4, available at
74
+ [http://contributor-covenant.org/version/1/4/][version].
75
+
76
+ [homepage]: http://contributor-covenant.org
77
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
- gem 'money'
5
+ gemspec
data/LICENSE CHANGED
@@ -1,20 +1,23 @@
1
+ Licensed under the MIT license:
2
+
3
+ https://opensource.org/licenses/mit-license.php
4
+
1
5
  Copyright (c) 2009 Trond Arve Nordheim
2
6
 
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
10
13
 
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
14
+ The above copyright notice and this permission notice shall be included in
15
+ all copies or substantial portions of the Software.
13
16
 
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,36 @@
1
+ # CurrencySelect
2
+
3
+ [![Build Status](https://travis-ci.org/braingourmets/currency_select.svg?branch=master)](https://travis-ci.org/braingourmets/currency_select)
4
+ [![Gem Version](https://badge.fury.io/rb/currency_select.svg)](http://badge.fury.io/rb/currency_select)
5
+
6
+ Adds a currency_select helper to Ruby on Rails projects, allowing you to get
7
+ a HTML select list of available currencies.
8
+
9
+ The list of currencies are provided by the [Money](http://money.rubyforge.org/)
10
+ gem.
11
+
12
+
13
+ ## Installation
14
+
15
+ Add the following to your Gemfile:
16
+
17
+ gem 'currency_select'
18
+
19
+
20
+ ## Example
21
+
22
+ currency_select("user", "currency")
23
+
24
+
25
+ ## Contributing to this project
26
+
27
+ ### Code of Conduct
28
+
29
+ This project adheres to a [Contributor Code of Conduct](CODE_OF_CONDUCT.md).
30
+ By participating in this project and its community, you are expected to uphold
31
+ this code.
32
+
33
+
34
+ ## Maintainers
35
+
36
+ * [Oliver Klee](https://github.com/oliverklee)
data/Rakefile CHANGED
@@ -1,76 +1,14 @@
1
- require "rake"
2
- require "bundler"
3
- require "rake/testtask"
4
- require "rdoc/task"
1
+ # frozen_string_literal: true
5
2
 
6
- # Gemcutter/Jeweler configuration
7
- # -----------------------------------------------------------------------------
8
- begin
9
-
10
- require "jeweler"
11
-
12
- Jeweler::Tasks.new do |gem|
13
-
14
- gem.name = "currency_select"
15
- gem.summary = "Currency Select plugin for Rails"
16
- gem.description = "Adds a currency_select helper to Ruby on Rails projects"
17
- gem.email = "tanordheim@gmail.com"
18
- gem.homepage = "http://github.com/tanordheim/currency_select"
19
- gem.authors = [ "Trond Arve Nordheim" ]
20
- gem.version = File.read('VERSION').chomp
21
-
22
- end
23
-
24
- Jeweler::GemcutterTasks.new
25
-
26
- rescue LoadError
27
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
28
- end
29
-
30
-
31
- # Test setup
32
- # -----------------------------------------------------------------------------
33
- Rake::TestTask.new(:test) do |t|
34
- t.libs << "lib" << "test"
35
- t.ruby_opts << "-rubygems"
36
- t.pattern = "test/**/*_test.rb"
37
- t.verbose = true
38
- end
3
+ require 'rdoc/task'
39
4
 
40
5
  # RDoc setup
41
6
  # ----------------------------------------------------------------------------
42
7
  Rake::RDocTask.new do |rdoc|
43
-
44
- version = File.exists?("VERSION") ? File.read("VERSION") : ""
8
+ version = File.read('VERSION')
45
9
 
46
- rdoc.rdoc_dir = "rdoc"
10
+ rdoc.rdoc_dir = 'rdoc'
47
11
  rdoc.title = "currency_select #{version}"
48
- rdoc.rdoc_files.include("README.rdoc")
49
- rdoc.rdoc_files.include("lib/**/*.rb")
50
-
12
+ rdoc.rdoc_files.include('README.md')
13
+ rdoc.rdoc_files.include('lib/**/*.rb')
51
14
  end
52
-
53
- # Rcov setup
54
- # ----------------------------------------------------------------------------
55
- begin
56
-
57
- require "rcov/rcovtask"
58
-
59
- Rcov::RcovTask.new do |test|
60
-
61
- test.libs << "test"
62
- test.pattern = "test/**/*_test.rb"
63
- test.verbose = "true"
64
-
65
- end
66
-
67
- rescue LoadError
68
- task :rcov do
69
- abort "Rcov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
70
- end
71
- end
72
-
73
- # Task setups
74
- # -----------------------------------------------------------------------------
75
- task :test => :check_dependencies
76
- task :default => :test
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.2.0
@@ -1,53 +1,21 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
1
+ # frozen_string_literal: true
5
2
 
6
- Gem::Specification.new do |s|
7
- s.name = "currency_select"
8
- s.version = "0.1.5"
3
+ version = File.read(File.expand_path('../VERSION', __FILE__)).strip
9
4
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Trond Arve Nordheim"]
12
- s.date = "2015-01-22"
13
- s.description = "Adds a currency_select helper to Ruby on Rails projects"
14
- s.email = "tanordheim@gmail.com"
15
- s.license = "MIT"
16
- s.extra_rdoc_files = [
17
- "LICENSE",
18
- "README.rdoc"
19
- ]
20
- s.files = [
21
- ".document",
22
- "Gemfile",
23
- "Gemfile.lock",
24
- "LICENSE",
25
- "README.rdoc",
26
- "Rakefile",
27
- "VERSION",
28
- "currency_select.gemspec",
29
- "lib/currency_select.rb",
30
- "rails/init.rb",
31
- "spec/currency_select_spec.rb",
32
- "spec/spec_helper.rb"
33
- ]
34
- s.homepage = "http://github.com/tanordheim/currency_select"
35
- s.require_paths = ["lib"]
36
- s.rubygems_version = "1.8.23"
37
- s.summary = "Currency Select plugin for Rails"
5
+ Gem::Specification.new do |s|
6
+ s.name = 'currency_select'
7
+ s.summary = 'Currency select plugin for Rails'
8
+ s.version = version
9
+ s.license = 'MIT'
38
10
 
39
- s.add_development_dependency 'rspec'
11
+ s.homepage = 'https://github.com/braingourmets/currency_select'
12
+ s.authors = ['Trond Arve Nordheim', 'Oliver Klee']
13
+ s.email = 'o.klee@braingourmets.com'
40
14
 
41
- if s.respond_to? :specification_version then
42
- s.specification_version = 3
15
+ 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)
16
+ s.extra_rdoc_files = %w(CHANGELOG.md LICENSE README.md)
43
17
 
44
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
45
- s.add_runtime_dependency(%q<money>, [">= 0"])
46
- else
47
- s.add_dependency(%q<money>, [">= 0"])
48
- end
49
- else
50
- s.add_dependency(%q<money>, [">= 0"])
51
- end
18
+ s.add_runtime_dependency 'actionview'
19
+ s.add_runtime_dependency 'money'
20
+ s.add_development_dependency 'rspec-rails'
52
21
  end
53
-
@@ -1,27 +1,62 @@
1
- require "money"
1
+ # frozen_string_literal: true
2
+
3
+ require 'money'
2
4
 
3
5
  module CurrencySelect
4
6
  class << self
7
+ ##
8
+ # Money::Currency::table is a hash of this format for each entry:
9
+ # id (lowercase) => {
10
+ # priority: 2,
11
+ # iso_code: "EUR",
12
+ # name: "Euro",
13
+ # symbol: "€",
14
+ # alternate_symbols: [],
15
+ # subunit: "Cent",
16
+ # subunit_to_unit: 100,
17
+ # symbol_first: true,
18
+ # html_entity: "&#x20AC;"
19
+ # decimal_mark: ",",
20
+ # thousands_separator: ".",
21
+ # iso_numeric: "978"
22
+ # smallest_denomination: 1
23
+ # }
24
+ unless const_defined?('CURRENCIES')
25
+ CURRENCIES = Money::Currency.table.inject([]) do |array, (_, currency)|
26
+ array << [
27
+ "#{currency[:name]} - #{currency[:iso_code]}", currency[:iso_code]
28
+ ]
29
+ end
30
+ # sort by the label (not by the ISO code)
31
+ CURRENCIES.sort_by(&:first)
32
+ end
5
33
 
6
- CURRENCIES = Money::Currency::table.inject([]) do |array, (id, currency)|
7
- array << [ "#{currency[:name]} - #{currency[:iso_code]}", id ]
8
- end.sort_by { |currency| currency.first } unless const_defined?("CURRENCIES")
9
-
10
- # Returns an array with ISO codes and currency names for <tt>option</tt>
11
- # tags.
34
+ ##
35
+ # Returns a two-dimensional array with ISO codes and currency names for
36
+ # <tt>option</tt> tags.
37
+ #
38
+ # In the outer array, there will be one element for each currency. Each
39
+ # element looks like this, containing a label and the ISO code:
40
+ # ["Afghan Afghani - AFN", "AFN"]
41
+ #
42
+ # @return [Array]
43
+ #
12
44
  def currencies_array
13
45
  CURRENCIES
14
46
  end
15
47
 
16
- # Return an array with ISO codes and currency names for currency ISO codes
48
+ ##
49
+ # Returns an array with ISO codes and currency names for currency ISO codes
17
50
  # passed as an argument
18
51
  # == Example
19
52
  # priority_currencies_array([ "USD", "NOK" ])
20
53
  # # => [ ['United States Dollar - USD', 'USD' ], ['Norwegian Kroner - NOK', 'NOK'] ]
54
+ #
55
+ # @return [Array]
56
+ #
21
57
  def priority_currencies_array(currency_codes = [])
22
- currency_codes.flat_map { |code| currencies_array.select { |currency| currency.last.to_s == code }}
58
+ currency_codes.flat_map {|code| currencies_array.select {|currency| currency.last.to_s == code}}
23
59
  end
24
-
25
60
  end
26
61
  end
27
62
 
@@ -29,18 +64,10 @@ end
29
64
  module ActionView
30
65
  module Helpers
31
66
  module FormOptionsHelper
32
-
33
67
  # Return select and option tags for the given object and method, using
34
68
  # currency_options_for_select to generate the list of option tags.
35
69
  def currency_select(object, method, priority_currencies = nil, options = {}, html_options = {})
36
- tag = if defined?(ActionView::Helpers::InstanceTag) &&
37
- ActionView::Helpers::InstanceTag.instance_method(:initialize).arity != 0
38
-
39
- InstanceTag.new(object, method, self, options.delete(:object))
40
- else
41
- CurrencySelectTag.new(object, method, self, options)
42
- end
43
-
70
+ tag = CurrencySelectTag.new(object, method, self, options)
44
71
  tag.to_currency_select_tag(priority_currencies, options, html_options)
45
72
  end
46
73
 
@@ -50,7 +77,7 @@ module ActionView
50
77
  # +priority_currencies+, so that they will be listed above the rest of
51
78
  # the list.
52
79
  def currency_options_for_select(selected = nil, priority_currencies = nil)
53
- currency_options = "".html_safe
80
+ currency_options = ''.html_safe
54
81
 
55
82
  if priority_currencies
56
83
  currency_options += options_for_select(::CurrencySelect::priority_currencies_array(priority_currencies), selected)
@@ -76,15 +103,8 @@ module ActionView
76
103
  end
77
104
  end
78
105
 
79
- if defined?(ActionView::Helpers::InstanceTag) &&
80
- ActionView::Helpers::InstanceTag.instance_method(:initialize).arity != 0
81
- class InstanceTag
82
- include ToCurrencySelectTag
83
- end
84
- else
85
- class CurrencySelectTag < Tags::Base
86
- include ToCurrencySelectTag
87
- end
106
+ class CurrencySelectTag < Tags::Base
107
+ include ToCurrencySelectTag
88
108
  end
89
109
 
90
110
  class FormBuilder
@@ -92,6 +112,5 @@ module ActionView
92
112
  @template.currency_select(@object_name, method, priority_currencies, options.merge(:object => @object), html_options)
93
113
  end
94
114
  end
95
-
96
115
  end
97
- end
116
+ end
data/rails/init.rb CHANGED
@@ -1 +1,3 @@
1
- require "currency_select"
1
+ # frozen_string_literal: true
2
+
3
+ require 'currency_select'
metadata CHANGED
@@ -1,64 +1,78 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: currency_select
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Trond Arve Nordheim
8
+ - Oliver Klee
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2015-01-22 00:00:00.000000000 Z
12
+ date: 2018-09-15 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
- name: rspec
15
+ name: actionview
15
16
  requirement: !ruby/object:Gem::Requirement
16
17
  requirements:
17
- - - '>='
18
+ - - ">="
18
19
  - !ruby/object:Gem::Version
19
20
  version: '0'
20
- type: :development
21
+ type: :runtime
21
22
  prerelease: false
22
23
  version_requirements: !ruby/object:Gem::Requirement
23
24
  requirements:
24
- - - '>='
25
+ - - ">="
25
26
  - !ruby/object:Gem::Version
26
27
  version: '0'
27
28
  - !ruby/object:Gem::Dependency
28
29
  name: money
29
30
  requirement: !ruby/object:Gem::Requirement
30
31
  requirements:
31
- - - '>='
32
+ - - ">="
32
33
  - !ruby/object:Gem::Version
33
34
  version: '0'
34
35
  type: :runtime
35
36
  prerelease: false
36
37
  version_requirements: !ruby/object:Gem::Requirement
37
38
  requirements:
38
- - - '>='
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: rspec-rails
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
39
54
  - !ruby/object:Gem::Version
40
55
  version: '0'
41
- description: Adds a currency_select helper to Ruby on Rails projects
42
- email: tanordheim@gmail.com
56
+ description:
57
+ email: o.klee@braingourmets.com
43
58
  executables: []
44
59
  extensions: []
45
60
  extra_rdoc_files:
61
+ - CHANGELOG.md
46
62
  - LICENSE
47
- - README.rdoc
63
+ - README.md
48
64
  files:
49
- - .document
65
+ - CHANGELOG.md
66
+ - CODE_OF_CONDUCT.md
50
67
  - Gemfile
51
- - Gemfile.lock
52
68
  - LICENSE
53
- - README.rdoc
69
+ - README.md
54
70
  - Rakefile
55
71
  - VERSION
56
72
  - currency_select.gemspec
57
73
  - lib/currency_select.rb
58
74
  - rails/init.rb
59
- - spec/currency_select_spec.rb
60
- - spec/spec_helper.rb
61
- homepage: http://github.com/tanordheim/currency_select
75
+ homepage: https://github.com/braingourmets/currency_select
62
76
  licenses:
63
77
  - MIT
64
78
  metadata: {}
@@ -68,18 +82,18 @@ require_paths:
68
82
  - lib
69
83
  required_ruby_version: !ruby/object:Gem::Requirement
70
84
  requirements:
71
- - - '>='
85
+ - - ">="
72
86
  - !ruby/object:Gem::Version
73
87
  version: '0'
74
88
  required_rubygems_version: !ruby/object:Gem::Requirement
75
89
  requirements:
76
- - - '>='
90
+ - - ">="
77
91
  - !ruby/object:Gem::Version
78
92
  version: '0'
79
93
  requirements: []
80
94
  rubyforge_project:
81
- rubygems_version: 2.0.14
95
+ rubygems_version: 2.7.7
82
96
  signing_key:
83
- specification_version: 3
84
- summary: Currency Select plugin for Rails
97
+ specification_version: 4
98
+ summary: Currency select plugin for Rails
85
99
  test_files: []
data/.document DELETED
@@ -1,5 +0,0 @@
1
- README.rdoc
2
- lib/**/*.rb
3
- bin/*
4
- features/**/*.feature
5
- LICENSE
data/Gemfile.lock DELETED
@@ -1,12 +0,0 @@
1
- GEM
2
- remote: https://rubygems.org/
3
- specs:
4
- i18n (0.6.4)
5
- money (6.0.0)
6
- i18n (~> 0.6.0)
7
-
8
- PLATFORMS
9
- ruby
10
-
11
- DEPENDENCIES
12
- money
data/README.rdoc DELETED
@@ -1,21 +0,0 @@
1
- = CurrencySelect
2
-
3
- Adds a currency_select helper to Ruby on Rails projects, allowing you to get
4
- a HTML select list of available currencies.
5
-
6
- The list of currencies are provided by the {Money}[http://money.rubyforge.org/] gem.
7
-
8
- = Installation
9
-
10
- Add the following to your Gemfile
11
-
12
- gem 'currency_select', github: 'tanordheim/currency_select'
13
-
14
-
15
- = Example
16
-
17
- currency_select("user", "currency")
18
-
19
- == Copyright
20
-
21
- Copyright (c) 2010 Trond Arve Nordheim. See LICENSE for details.
@@ -1,76 +0,0 @@
1
- require 'spec_helper'
2
- require 'action_view'
3
- require 'currency_select'
4
-
5
- module ActionView
6
- module Helpers
7
-
8
- describe CurrencySelect do
9
- include TagHelper
10
-
11
- class User
12
- attr_accessor :currency_code
13
- end
14
-
15
- let(:user) { User.new }
16
- let(:template) { ActionView::Base.new }
17
- let(:select_tag) do
18
- "<select id=\"user_currency_code\" name=\"user[currency_code]\">"
19
- end
20
-
21
- let(:selected_eur_option) do
22
- if defined?(Tags::Base)
23
- content_tag(:option, 'Euro - EUR', selected: :selected, value: 'eur')
24
- else
25
- "<option value=\"eur\" selected=\"selected\">Euro - EUR</option>"
26
- end
27
- end
28
-
29
- let(:builder) do
30
- if defined?(Tags::Base)
31
- FormBuilder.new(:user, user, template, {})
32
- else
33
- FormBuilder.new(:user, user, template, {}, Proc.new { })
34
- end
35
- end
36
-
37
- describe "currency_select" do
38
- let(:tag) { builder.currency_select(:currency_code) }
39
-
40
- it "creates a select tag" do
41
- tag.should include(select_tag)
42
- end
43
-
44
- it "creates option tags for each currency" do
45
- ::CurrencySelect.currencies_array.each do |name, code|
46
- tag.should include(content_tag(:option, name, value: code))
47
- end
48
- end
49
-
50
- it "selects the value of currency_code" do
51
- user.currency_code = 'eur'
52
- t = builder.currency_select(:currency_code)
53
- t.should include(selected_eur_option)
54
- end
55
-
56
- it "does not mark two currencies as selected" do
57
- user.currency_code = "usd"
58
- str = "<option value=\"us\" selected=\"selected\">United States</option>".html_safe
59
- tag.should_not include(str)
60
- end
61
-
62
- describe "priority currencies" do
63
- let(:tag) { builder.currency_select(:currency_code, ['eur']) }
64
-
65
- it "inserts the priority currencies at the top" do
66
- tag.should include("#{select_tag}<option value=\"eur")
67
- end
68
-
69
- it "inserts a divider" do
70
- tag.should include("<option value=\"\" disabled=\"disabled\">-------------</option>")
71
- end
72
- end
73
- end
74
- end
75
- end
76
- end
data/spec/spec_helper.rb DELETED
@@ -1,7 +0,0 @@
1
- RSpec.configure do |config|
2
- # Run specs in random order to surface order dependencies. If you find an
3
- # order dependency and want to debug it, you can fix the order by providing
4
- # the seed, which is printed after each run.
5
- # --seed 1234
6
- config.order = 'random'
7
- end