country_currency 0.1.0 → 0.1.1

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
- ---
2
- SHA512:
3
- metadata.gz: 8cc502aed9b616106b60d001f5531dae19e07282aeb8beaad9867ceab5e27f283b6fce3491a0cd12c14b9b8fd7969f77751ae0b8c2097ab18a4c074011c93663
4
- data.tar.gz: 4480b9b7de243a0a93620f59cdb1bb3b541b948bf62a88d99dc529223c6eefda8adf567589d5476eb59ee7fc57d851b2e6de458ea00336d747aaece707ec10fd
5
- SHA1:
6
- metadata.gz: ac36250cd36d45f60f414e821602937fa5c76bf8
7
- data.tar.gz: f60747b35c4fa5e637cc1ee5fb7c25da8e1e7852
1
+ ---
2
+ SHA256:
3
+ metadata.gz: dc801208aa60f49c25b7896337aeca7e131f2cff61a58246c4e024fac2523948
4
+ data.tar.gz: 29775e974c687b39d6e5f6bff94ead86291073beb11dd7b22f90f4c2f89df411
5
+ SHA512:
6
+ metadata.gz: b8b09eb836a7d0d5ba46ecf6838fedbfbb4b7639373856d2d47e59649a32fa545fc2d2db66ca3995aa6ab76fbfd04e084728084b2e0cb6e1fb37f0f36f543831
7
+ data.tar.gz: e8e42fc7012f52a96c306b5aca076b7990346857604924d0547ab456f6690970b76f49bb39e455e851b10f7f271c36e29af240889acd9fc09213c083cc680dd2
data/README.md CHANGED
@@ -4,6 +4,8 @@
4
4
 
5
5
  Provides ISO codes, names and currencies for countries.
6
6
 
7
+ ## Ruby Version >= 2.4
8
+
7
9
  ## USE:
8
10
  ```ruby
9
11
  # Search by country (Argentina)
@@ -37,6 +37,19 @@ module CountryCurrency # :nodoc:
37
37
  instance
38
38
  end
39
39
 
40
+ def find_by_currency(code, &fallback)
41
+ # Only use for currency data
42
+ fallback ||= DEFAULT_FALLBACK
43
+
44
+ code = code.to_s.upcase
45
+ instance = all.select { |c| c.currency == code }.first
46
+
47
+ return fallback.call "No ISO 3166-1 codes could be found searching with currency '#{code}'." if instance.nil?
48
+
49
+ instance
50
+ end
51
+
52
+
40
53
  def search_by_name(str, &fallback)
41
54
  fallback ||= DEFAULT_FALLBACK
42
55
 
@@ -1,3 +1,3 @@
1
1
  module CountryCurrency
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.1.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,63 +1,70 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: country_currency
3
- version: !ruby/object:Gem::Version
4
- version: 0.1.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
5
  platform: ruby
6
- authors:
7
- - "N\xC3\xA9stor Coppi"
6
+ authors:
7
+ - Néstor Coppi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
-
12
- date: 2018-04-20 00:00:00 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
11
+ date: 2018-04-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
15
14
  name: rake
16
- prerelease: false
17
- requirement: &id001 !ruby/object:Gem::Requirement
18
- requirements:
19
- - - ~>
20
- - !ruby/object:Gem::Version
21
- version: "12"
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '12'
22
20
  type: :runtime
23
- version_requirements: *id001
24
- - !ruby/object:Gem::Dependency
25
- name: tzinfo
26
21
  prerelease: false
27
- requirement: &id002 !ruby/object:Gem::Requirement
28
- requirements:
29
- - - ~>
30
- - !ruby/object:Gem::Version
31
- version: "1"
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '12'
27
+ - !ruby/object:Gem::Dependency
28
+ name: tzinfo
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1'
32
34
  type: :runtime
33
- version_requirements: *id002
34
- - !ruby/object:Gem::Dependency
35
- name: test-unit
36
35
  prerelease: false
37
- requirement: &id003 !ruby/object:Gem::Requirement
38
- requirements:
39
- - - ~>
40
- - !ruby/object:Gem::Version
41
- version: "3.2"
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: test-unit
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.2'
42
48
  type: :development
43
- version_requirements: *id003
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.2'
44
55
  description: ISO country code and currency library
45
56
  email: nestorcoppi@gmail.com
46
57
  executables: []
47
-
48
58
  extensions: []
49
-
50
59
  extra_rdoc_files: []
51
-
52
- files:
53
- - .travis.yml
60
+ files:
61
+ - ".travis.yml"
54
62
  - CHANGELOG.md
55
63
  - Gemfile
56
64
  - Gemfile.lock
57
65
  - Manifest.txt
58
66
  - README.md
59
67
  - Rakefile
60
- - VERSION
61
68
  - country_currency.gemspec
62
69
  - lib/country_currency.rb
63
70
  - lib/country_currency/calling.rb
@@ -75,30 +82,27 @@ files:
75
82
  - rakelib/iso_3166_1.rb.erb
76
83
  - test/country_currency_test.rb
77
84
  homepage: http://github.com/sequre/country_currency
78
- licenses:
85
+ licenses:
79
86
  - MIT
80
87
  metadata: {}
81
-
82
88
  post_install_message:
83
89
  rdoc_options: []
84
-
85
- require_paths:
90
+ require_paths:
86
91
  - lib
87
- required_ruby_version: !ruby/object:Gem::Requirement
88
- requirements:
89
- - &id004
90
- - ">="
91
- - !ruby/object:Gem::Version
92
- version: "0"
93
- required_rubygems_version: !ruby/object:Gem::Requirement
94
- requirements:
95
- - *id004
92
+ required_ruby_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ required_rubygems_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
96
102
  requirements: []
97
-
98
103
  rubyforge_project:
99
- rubygems_version: 2.6.12
104
+ rubygems_version: 2.7.6
100
105
  signing_key:
101
106
  specification_version: 4
102
107
  summary: Provides ISO 3166-1 country codes/names and ISO 4217 currencies.
103
108
  test_files: []
104
-
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.7.8