iso-639 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/iso-639.gemspec +2 -2
- data/lib/iso-639.rb +6 -6
- data/test/test_ISO_639.rb +4 -0
- metadata +71 -59
data/iso-639.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "iso-639"
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["William Melody"]
|
12
|
-
s.date = "2013-10-
|
12
|
+
s.date = "2013-10-23"
|
13
13
|
s.description = "ISO 639-1 and ISO 639-2 language code entries and convenience methods"
|
14
14
|
s.email = "hi@williammelody.com"
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/iso-639.rb
CHANGED
@@ -536,7 +536,7 @@ class ISO_639 < Array
|
|
536
536
|
def find_by_code(code)
|
537
537
|
case code.length
|
538
538
|
when 3
|
539
|
-
ISO_639_2.detect { |entry| entry if entry.alpha3 == code }
|
539
|
+
ISO_639_2.detect { |entry| entry if entry.alpha3 == code || entry.alpha3_terminologic == code }
|
540
540
|
when 2
|
541
541
|
ISO_639_1.detect { |entry| entry if entry.alpha2 == code }
|
542
542
|
end
|
@@ -564,15 +564,15 @@ class ISO_639 < Array
|
|
564
564
|
end
|
565
565
|
|
566
566
|
# The entry's alpha-3 bibliotigraphic code.
|
567
|
-
def alpha3_bibliographic;
|
567
|
+
def alpha3_bibliographic; self[0] end
|
568
568
|
alias_method :alpha3, :alpha3_bibliographic
|
569
569
|
# The entry's alpha-3 terminologic (when given)
|
570
|
-
def alpha3_terminologic;
|
570
|
+
def alpha3_terminologic; self[1] end
|
571
571
|
# The entry's alpha-2 code (when given)
|
572
|
-
def alpha2;
|
572
|
+
def alpha2; self[2] end
|
573
573
|
# The entry's english name.
|
574
|
-
def english_name;
|
574
|
+
def english_name; self[3] end
|
575
575
|
# The entry's french name.
|
576
|
-
def french_name;
|
576
|
+
def french_name; self[4] end
|
577
577
|
|
578
578
|
end
|
data/test/test_ISO_639.rb
CHANGED
@@ -15,6 +15,10 @@ class TestISO639 < Test::Unit::TestCase
|
|
15
15
|
assert_equal ["eng", "", "en", "English", "anglais"], ISO_639.find_by_code("en")
|
16
16
|
assert_equal ["eng", "", "en", "English", "anglais"], ISO_639.find("en")
|
17
17
|
end
|
18
|
+
|
19
|
+
should "return entry for alpha-3 terminologic code" do
|
20
|
+
assert_equal ["ger", "deu", "de", "German", "allemand"], ISO_639.find("deu")
|
21
|
+
end
|
18
22
|
|
19
23
|
should "find by english name" do
|
20
24
|
assert_equal ["eng", "", "en", "English", "anglais"], ISO_639.find_by_english_name("English")
|
metadata
CHANGED
@@ -1,72 +1,75 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: iso-639
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
- 4
|
10
|
+
version: 0.2.4
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- William Melody
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
17
|
+
|
18
|
+
date: 2013-10-23 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
15
21
|
name: mocha
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ! '>='
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '0'
|
22
|
-
type: :development
|
23
22
|
prerelease: false
|
24
|
-
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
24
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - ~>
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: '3.12'
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
version: "0"
|
38
32
|
type: :development
|
33
|
+
version_requirements: *id001
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: rdoc
|
39
36
|
prerelease: false
|
40
|
-
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
38
|
none: false
|
42
|
-
requirements:
|
39
|
+
requirements:
|
43
40
|
- - ~>
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
requirements:
|
51
|
-
- - ! '>='
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '0'
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
hash: 31
|
43
|
+
segments:
|
44
|
+
- 3
|
45
|
+
- 12
|
46
|
+
version: "3.12"
|
54
47
|
type: :development
|
48
|
+
version_requirements: *id002
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: shoulda
|
55
51
|
prerelease: false
|
56
|
-
|
52
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
57
53
|
none: false
|
58
|
-
requirements:
|
59
|
-
- -
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
58
|
+
segments:
|
59
|
+
- 0
|
60
|
+
version: "0"
|
61
|
+
type: :development
|
62
|
+
version_requirements: *id003
|
62
63
|
description: ISO 639-1 and ISO 639-2 language code entries and convenience methods
|
63
64
|
email: hi@williammelody.com
|
64
65
|
executables: []
|
66
|
+
|
65
67
|
extensions: []
|
66
|
-
|
68
|
+
|
69
|
+
extra_rdoc_files:
|
67
70
|
- LICENSE
|
68
71
|
- README.markdown
|
69
|
-
files:
|
72
|
+
files:
|
70
73
|
- .document
|
71
74
|
- Gemfile
|
72
75
|
- Gemfile.lock
|
@@ -78,28 +81,37 @@ files:
|
|
78
81
|
- test/helper.rb
|
79
82
|
- test/test_ISO_639.rb
|
80
83
|
homepage: http://github.com/alphabetum/iso-639
|
81
|
-
licenses:
|
84
|
+
licenses:
|
82
85
|
- MIT
|
83
86
|
post_install_message:
|
84
87
|
rdoc_options: []
|
85
|
-
|
88
|
+
|
89
|
+
require_paths:
|
86
90
|
- lib
|
87
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
88
92
|
none: false
|
89
|
-
requirements:
|
90
|
-
- -
|
91
|
-
- !ruby/object:Gem::Version
|
92
|
-
|
93
|
-
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
hash: 3
|
97
|
+
segments:
|
98
|
+
- 0
|
99
|
+
version: "0"
|
100
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
101
|
none: false
|
95
|
-
requirements:
|
96
|
-
- -
|
97
|
-
- !ruby/object:Gem::Version
|
98
|
-
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
hash: 3
|
106
|
+
segments:
|
107
|
+
- 0
|
108
|
+
version: "0"
|
99
109
|
requirements: []
|
110
|
+
|
100
111
|
rubyforge_project:
|
101
|
-
rubygems_version: 1.8.
|
112
|
+
rubygems_version: 1.8.23
|
102
113
|
signing_key:
|
103
114
|
specification_version: 3
|
104
115
|
summary: ISO 639-1 and ISO 639-2 language code entries and convenience methods
|
105
116
|
test_files: []
|
117
|
+
|