iso639 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -41,8 +41,12 @@ module Iso639
41
41
  LanguagesByAlpha2[lang.alpha2] = lang if lang.alpha2
42
42
  LanguagesByAlpha3[lang.alpha3] = lang if lang.alpha3
43
43
  LanguagesByAlpha3Terminology[lang.alpha3_terminology] = lang if lang.alpha3_terminology
44
- LanguagesByName[lang.name] = lang if lang.name
45
- LanguagesByFrenchName[lang.french_name] = lang if lang.french_name
44
+ lang.name.split(/;\s*/).each do |name|
45
+ LanguagesByName[name] = lang
46
+ end
47
+ lang.french_name.split(/;\s*/).each do |name|
48
+ LanguagesByFrenchName[name] = lang
49
+ end
46
50
  end
47
51
 
48
52
  # Public: Find a language by any common lookup value
@@ -1,3 +1,3 @@
1
1
  module Iso639
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.4"
3
3
  end
@@ -46,10 +46,13 @@ end
46
46
 
47
47
  describe Iso639::LanguagesByEnglishName do
48
48
  it "should return valid languages by name" do
49
- assert_equal "en", Iso639::LanguagesByName["ENGLISH"].alpha2
50
- assert_equal "fre", Iso639::LanguagesByName["French"].alpha3
51
- assert_equal "German", Iso639::LanguagesByName["German"].name
52
- assert_equal "German", Iso639::LanguagesByName["german"].name
49
+ assert_equal "en", Iso639::LanguagesByName["ENGLISH"].alpha2
50
+ assert_equal "fre", Iso639::LanguagesByName["French"].alpha3
51
+ assert_equal "German", Iso639::LanguagesByName["German"].name
52
+ assert_equal "German", Iso639::LanguagesByName["german"].name
53
+ assert_equal "spa", Iso639::LanguagesByName["spanish"].alpha3
54
+ assert_equal "klingon", Iso639::LanguagesByName["Klingon"].french_name
55
+ assert_equal "Klingon; tlhIngan-Hol", Iso639::LanguagesByName["tlhIngan-Hol"].name
53
56
  end
54
57
 
55
58
  it "should return nil for unknown codes" do
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: iso639
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.0.3
5
+ version: 1.0.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - Ryan McGeary