language_list 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +3 -2
- data/Gemfile +1 -1
- data/README.md +6 -0
- data/Rakefile +18 -1
- data/data/dump +0 -0
- data/data/languages.yml +1 -0
- data/language_list.gemspec +2 -0
- data/lib/language_list.rb +5 -0
- data/lib/language_list/version.rb +1 -1
- data/test/language_list_test.rb +12 -5
- metadata +38 -18
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5f694a7105df99148d7a9f8a7d2a8bfceceac7a1
|
4
|
+
data.tar.gz: 7d45966d267cee5b931269a4e97e68533cf5e437
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e76121fbd53e3317ca32d4e65a39670589f115dbea52923bc9f4d9e11d912e87faa227aeb386bc3b592e01a0ada009405c8039e24a480b58ce671a5880b4527e
|
7
|
+
data.tar.gz: b2566e64c6bda74ce1f308e3113a5d11fade539a1eecbb5f84092ecbfb8fbcdb9751e3ede3df44a595e1f85ed268dea66d9d636742e4f85c35f2bf5e89b443b0
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# Language List
|
2
2
|
A list of languages based upon ISO-639-1 and ISO-639-3 with functions to retrieve only common languages.
|
3
3
|
|
4
|
+
[![Build Status](https://travis-ci.org/scsmith/language_list.svg?branch=master)](https://travis-ci.org/scsmith/language_list)
|
5
|
+
|
4
6
|
## Examples
|
5
7
|
# Get an array of LanguageList::LanguageInfo classes
|
6
8
|
all_languages = LanguageList::ALL_LANGUAGES
|
@@ -15,6 +17,10 @@ A list of languages based upon ISO-639-1 and ISO-639-3 with functions to retriev
|
|
15
17
|
english.iso_639_3.inspect #=> "eng"
|
16
18
|
english.common? #=> true
|
17
19
|
|
20
|
+
## Testing
|
21
|
+
|
22
|
+
rake
|
23
|
+
|
18
24
|
## Thanks
|
19
25
|
Thanks goes to Steve Hardie for his work on creating a list of common languages (http://stevehardie.com/2009/10/list-of-common-languages/).
|
20
26
|
|
data/Rakefile
CHANGED
@@ -1,2 +1,19 @@
|
|
1
|
-
require 'bundler'
|
1
|
+
require 'bundler/setup'
|
2
|
+
require 'language_list'
|
2
3
|
Bundler::GemHelper.install_tasks
|
4
|
+
|
5
|
+
require 'rake/testtask'
|
6
|
+
Rake::TestTask.new do |t|
|
7
|
+
t.test_files = FileList['test/language_list_test.rb']
|
8
|
+
t.verbose = true
|
9
|
+
end
|
10
|
+
|
11
|
+
task :dump do
|
12
|
+
path = File.expand_path(File.join('..', 'data', 'languages.yml'), __FILE__)
|
13
|
+
data = YAML.load_file(path)
|
14
|
+
entries = data.map { |entry| LanguageList::LanguageInfo.new(entry) }
|
15
|
+
output_path = File.expand_path(File.join('..', 'data', 'dump'), __FILE__)
|
16
|
+
File.write(output_path, Marshal.dump(entries))
|
17
|
+
end
|
18
|
+
|
19
|
+
task :default => :test
|
data/data/dump
CHANGED
Binary file
|
data/data/languages.yml
CHANGED
@@ -14224,6 +14224,7 @@
|
|
14224
14224
|
:type: :living
|
14225
14225
|
:scope: :individual
|
14226
14226
|
- :name: Modern Greek (1453-)
|
14227
|
+
:common_name: Greek
|
14227
14228
|
:iso_639_1: el
|
14228
14229
|
:iso_639_3: ell
|
14229
14230
|
:iso_639_2b: gre
|
data/language_list.gemspec
CHANGED
@@ -18,4 +18,6 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
19
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
20
|
s.require_paths = ["lib"]
|
21
|
+
s.add_development_dependency 'minitest', '> 5.0.0'
|
22
|
+
s.add_development_dependency 'rake'
|
21
23
|
end
|
data/lib/language_list.rb
CHANGED
@@ -6,12 +6,17 @@ module LanguageList
|
|
6
6
|
|
7
7
|
def initialize(options)
|
8
8
|
@name = options[:name]
|
9
|
+
@common_name = options[:common_name]
|
9
10
|
@iso_639_3 = options[:iso_639_3]
|
10
11
|
@iso_639_1 = options[:iso_639_1]
|
11
12
|
@common = options[:common]
|
12
13
|
@type = options[:type]
|
13
14
|
end
|
14
15
|
|
16
|
+
def common_name
|
17
|
+
@common_name || @name
|
18
|
+
end
|
19
|
+
|
15
20
|
def common?
|
16
21
|
@common
|
17
22
|
end
|
data/test/language_list_test.rb
CHANGED
@@ -1,10 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
$:.unshift(File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')))
|
4
|
-
require 'test/unit'
|
1
|
+
require 'minitest/autorun'
|
5
2
|
require 'language_list'
|
6
3
|
|
7
|
-
class LanguageListTest < Test
|
4
|
+
class LanguageListTest < Minitest::Test
|
8
5
|
def test_all_languages
|
9
6
|
assert_equal 7707, LanguageList::ALL_LANGUAGES.length
|
10
7
|
end
|
@@ -69,4 +66,14 @@ class LanguageListTest < Test::Unit::TestCase
|
|
69
66
|
|
70
67
|
assert_equal expected, sorted.map(&:name)
|
71
68
|
end
|
69
|
+
|
70
|
+
def test_common_name_when_present
|
71
|
+
greek = LanguageList::LanguageInfo.find('el')
|
72
|
+
assert_equal 'Greek', greek.common_name
|
73
|
+
end
|
74
|
+
|
75
|
+
def test_common_name_when_not_present
|
76
|
+
english = LanguageList::LanguageInfo.find('en')
|
77
|
+
assert_equal english.name, english.common_name
|
78
|
+
end
|
72
79
|
end
|
metadata
CHANGED
@@ -1,16 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: language_list
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.1.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Steve Smith
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
13
|
-
dependencies:
|
11
|
+
date: 2015-03-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: minitest
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 5.0.0
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 5.0.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
14
41
|
description: A list of languages based upon ISO-639-1 and ISO-639-3 with functions
|
15
42
|
to retrieve only common languages.
|
16
43
|
email:
|
@@ -19,8 +46,8 @@ executables: []
|
|
19
46
|
extensions: []
|
20
47
|
extra_rdoc_files: []
|
21
48
|
files:
|
22
|
-
- .gitignore
|
23
|
-
- .travis.yml
|
49
|
+
- ".gitignore"
|
50
|
+
- ".travis.yml"
|
24
51
|
- Gemfile
|
25
52
|
- README.md
|
26
53
|
- Rakefile
|
@@ -34,33 +61,26 @@ files:
|
|
34
61
|
- test/language_list_test.rb
|
35
62
|
homepage: https://github.com/scsmith/language_list
|
36
63
|
licenses: []
|
64
|
+
metadata: {}
|
37
65
|
post_install_message:
|
38
66
|
rdoc_options: []
|
39
67
|
require_paths:
|
40
68
|
- lib
|
41
69
|
required_ruby_version: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
70
|
requirements:
|
44
|
-
- -
|
71
|
+
- - ">="
|
45
72
|
- !ruby/object:Gem::Version
|
46
73
|
version: '0'
|
47
|
-
segments:
|
48
|
-
- 0
|
49
|
-
hash: 4409535527429711707
|
50
74
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
|
-
none: false
|
52
75
|
requirements:
|
53
|
-
- -
|
76
|
+
- - ">="
|
54
77
|
- !ruby/object:Gem::Version
|
55
78
|
version: '0'
|
56
|
-
segments:
|
57
|
-
- 0
|
58
|
-
hash: 4409535527429711707
|
59
79
|
requirements: []
|
60
80
|
rubyforge_project: language_list
|
61
|
-
rubygems_version:
|
81
|
+
rubygems_version: 2.2.2
|
62
82
|
signing_key:
|
63
|
-
specification_version:
|
83
|
+
specification_version: 4
|
64
84
|
summary: A list of languages and methods to find and work with these languages.
|
65
85
|
test_files:
|
66
86
|
- test/benchmark.rb
|