csv_country_selector 1.0.7 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/csv_country_selector.gemspec +1 -1
- data/lib/csv_country_selector.rb +25 -25
- data/lib/csv_country_selector/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e019dd3d6da9a8dc24ab57908467ba1ba03868f
|
4
|
+
data.tar.gz: 66438dc20939ad9ba9e28944f0350af414798a65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f49791280a557ff531219add599a3b9b1e84bbb19fa3f33ea466fa5f263b7f429f38532315bdd62074bb43678001236e85f71700b97e4402438eeb5cdd12af6
|
7
|
+
data.tar.gz: 836f4d4a2d32577d02708e39a3dd3650e592f02612147964c21855386c1c3aba182382c92e4f350fb8047cf64ef632fbec8fdb89e68285b3702659edbd467db9
|
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.authors = ["Marco Metz"]
|
12
12
|
spec.email = ["marco.metz@gmail.com"]
|
13
13
|
spec.summary = %q{Country List with long and short names}
|
14
|
-
spec.description = %q{Country list based on a csv file
|
14
|
+
spec.description = %q{Country list based on a csv file with long an short names for Dropdowns and selections}
|
15
15
|
spec.homepage = "https://github.com/ikuseiGmbH/csv_country_selector"
|
16
16
|
spec.license = "MIT"
|
17
17
|
|
data/lib/csv_country_selector.rb
CHANGED
@@ -6,38 +6,38 @@ require "csv_country_selector/version"
|
|
6
6
|
module CsvCountrySelector
|
7
7
|
class Country
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
#CSV Tabelle als Masterfreferenz
|
10
|
+
#Lnd;Kfz;Sprache;ISO-Code;Kurzbez;Bezeichnung;Nationalität;Bezeichnung lang
|
11
|
+
@@codes = ::CSV.read("#{File.dirname(File.expand_path(__FILE__))}/csv_country_selector/countries.csv", :col_sep => ";").inject({}){|a,b| a.merge!({b[0].force_encoding('UTF-8') => b[5].force_encoding('UTF-8')})}
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
def self.short_name_for(name)
|
18
|
-
@@codes.select{|k,v| v.downcase == name.downcase}.try(:first).try(:first)
|
19
|
-
end
|
13
|
+
#CSV Tabelle der Europäischen Länder
|
14
|
+
#Lnd;Kfz;Sprache;ISO-Code;Kurzbez;Bezeichnung;Nationalität;Bezeichnung lang
|
15
|
+
@@eu_codes = ::CSV.read("#{File.dirname(File.expand_path(__FILE__))}/csv_country_selector/eu_countries.csv", :col_sep => ";").inject({}){|a,b| a.merge!({b[0].force_encoding('UTF-8') => b[5].force_encoding('UTF-8')})}
|
20
16
|
|
17
|
+
def self.short_name_for(name)
|
18
|
+
@@codes.select{|k,v| v.downcase == name.downcase}.try(:first).try(:first)
|
19
|
+
end
|
21
20
|
|
22
|
-
def self.long_name_for(name)
|
23
|
-
@@codes.select{|k,v| k.downcase == name.downcase}.try(:first).try(:last)
|
24
|
-
end
|
25
21
|
|
26
|
-
|
27
|
-
|
28
|
-
|
22
|
+
def self.long_name_for(name)
|
23
|
+
@@codes.select{|k,v| k.downcase == name.downcase}.try(:first).try(:last)
|
24
|
+
end
|
29
25
|
|
30
|
-
|
31
|
-
|
32
|
-
|
26
|
+
def self.long_list
|
27
|
+
@@codes.values
|
28
|
+
end
|
33
29
|
|
34
|
-
|
35
|
-
|
36
|
-
|
30
|
+
def self.short_list
|
31
|
+
@@codes.values
|
32
|
+
end
|
37
33
|
|
38
|
-
|
39
|
-
|
40
|
-
|
34
|
+
def self.codes
|
35
|
+
@@codes
|
36
|
+
end
|
41
37
|
|
38
|
+
def self.is_in_eu?(country_short_name)
|
39
|
+
@@eu_codes.values.include?(country_short_name)
|
42
40
|
end
|
41
|
+
|
42
|
+
end
|
43
43
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: csv_country_selector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marco Metz
|
@@ -38,7 +38,7 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
|
-
description: Country list based on a csv file
|
41
|
+
description: Country list based on a csv file with long an short names for Dropdowns
|
42
42
|
and selections
|
43
43
|
email:
|
44
44
|
- marco.metz@gmail.com
|