iso-639-data 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,40 @@
1
+ require "iso-639-data/version"
2
+ require "yaml"
3
+
4
+ module ISO_639_DATA
5
+ class Error < StandardError; end
6
+
7
+ ISO_639_2 = lambda do
8
+ YAML.load(File.read(File.join(File.dirname(__FILE__), '2.yaml'))).tap do |h|
9
+ h.each do |k,v|
10
+ v.freeze
11
+ end
12
+ end
13
+ end.call.freeze
14
+
15
+ ISO_639_3 = lambda do
16
+ YAML.load(File.read(File.join(File.dirname(__FILE__), '3.yaml'))).tap do |h|
17
+ h.each do |k,v|
18
+ v.freeze
19
+ end
20
+ end
21
+ end.call.freeze
22
+
23
+ class << self
24
+ def codes
25
+ (ISO_639_2.keys << ISO_639_3.keys).flatten.uniq
26
+ end
27
+
28
+ def validate?(code)
29
+ codes.include? code
30
+ end
31
+
32
+ def iso_639_2
33
+ ISO_639_2
34
+ end
35
+
36
+ def iso_639_3
37
+ ISO_639_3
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,3 @@
1
+ module ISO_639_DATA
2
+ VERSION = "0.1.1"
3
+ end
metadata ADDED
@@ -0,0 +1,61 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: iso-639-data
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - webdev778
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-11-06 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: ISO 639-X language code entries.
14
+ email:
15
+ - webdev778@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".gitignore"
21
+ - ".rspec"
22
+ - ".travis.yml"
23
+ - CODE_OF_CONDUCT.md
24
+ - Gemfile
25
+ - Gemfile.lock
26
+ - LICENSE.txt
27
+ - README.md
28
+ - Rakefile
29
+ - bin/console
30
+ - bin/setup
31
+ - iso-639-data.gemspec
32
+ - lib/2.yaml
33
+ - lib/3.yaml
34
+ - lib/iso-639-data.rb
35
+ - lib/iso-639-data/version.rb
36
+ homepage: https://github.com/webdev778/iso-639-data
37
+ licenses:
38
+ - MIT
39
+ metadata:
40
+ homepage_uri: https://github.com/webdev778/iso-639-data
41
+ source_code_uri: https://github.com/webdev778/iso-639-data
42
+ post_install_message:
43
+ rdoc_options: []
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: 2.3.0
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ requirements: []
57
+ rubygems_version: 3.1.2
58
+ signing_key:
59
+ specification_version: 4
60
+ summary: ISO 639-X language code entries.
61
+ test_files: []