rtl 0.2.0 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0420bcd62ecc5c3dac0add59107f3f96ae724298
4
- data.tar.gz: 168c92c2f7149f37ca6217507218af295fd02fa2
3
+ metadata.gz: 1a86faa9860088b875b32f4c1d5c3338992e21d6
4
+ data.tar.gz: 33a7f7dbbc882768b3a028e36398ccb38bfe8d8a
5
5
  SHA512:
6
- metadata.gz: c83adfdeeade65119ceb41cedb68b41e95dfc3d748f7782818f7c90480527cf99b6f13abbdff39cc14997643f24e153294a9f78f3c24b65f68cc72d0bb1c6535
7
- data.tar.gz: 777fd01f9183710e621bbf38ee30c8681b7f8a7279337c602cdec44893866284ed682bb73a71d0a051061306f75dfb4b61ae4dd64674f29b358f45bb624adcdb
6
+ metadata.gz: d650eb3ed73341f35915cecb96a176d81c1ef72a44f126966282d55c73b7e9f1522443de969d17d6255741b3c9151acebe7112c9875e60754ce8250b7aa682ad
7
+ data.tar.gz: 94236b3ccad637985c7853c99790b3ab6481433479ac4ab73e16f56c0924ef9ae98fcbaec3cf327d7e94a6f069353d2876da952941317a0672b9928c2526743a
data/README.md CHANGED
@@ -25,7 +25,50 @@ $ gem install rtl
25
25
 
26
26
  ## Usage
27
27
 
28
- ...
28
+ ```ruby
29
+ require 'rtl'
30
+
31
+ # Query a language by string or symbol.
32
+ Rtl.rtl? 'ar' #=> true
33
+ Rtl.rtl? :ara #=> true
34
+
35
+
36
+ # By ISO 639 code, (The default) ..
37
+ Rtl.rtl? :syc, :iso_code #=> true
38
+ Rtl.rtl? :eng #=> false
39
+
40
+
41
+ # By ISO 15924 code ..
42
+ Rtl.rtl? 'Hung', :iso_long_code #=> true
43
+
44
+
45
+ # By ISO number ..
46
+ Rtl.rtl? 130, :iso_number #=> true
47
+
48
+
49
+ # By unicode alias ..
50
+ Rtl.rtl? 'Hebrew', :unicode_alias #=> true
51
+
52
+
53
+ # By full name ..
54
+ Rtl.rtl? :Persian, :full_name #=> true
55
+
56
+
57
+ # Get List of all languages by any of the above criteria
58
+ Rtl.rtl_languages
59
+ #=> ["ar", "ara", "arc", "ae", "ave", "egy", "he", "heb", "nqo", "pal", "phn", "sam", "syc", "syr", "fa", "per", "fas", "ku", "kur"]
60
+
61
+ Rtl.rtl_languages :iso_long_code
62
+ #=> ...
63
+
64
+ ```
65
+
66
+ ## Useful Links
67
+ * [ISO 639-2 Language Code List - Codes for the representation of names of languages (Library of Congress).](https://www.loc.gov/standards/iso639-2/php/code_list.php)
68
+ * [List of ISO 639-1 codes on Wikipedia.](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes)
69
+ * [Right-to-left on Wikipedia.](https://en.wikipedia.org/wiki/Right-to-left)
70
+ * [ISO 15924 on Wikipedia.](https://en.wikipedia.org/wiki/ISO_15924)
71
+ * [Questions & Answers: Which languages are written right-to-left (RTL)?](http://www.i18nguy.com/temp/rtl.html)
29
72
 
30
73
  ## Contributing
31
74
 
@@ -66,8 +66,13 @@ module Rtl
66
66
  def self.rtl_languages scheme = :iso_code
67
67
  sch = scheme.to_s
68
68
  s = sch.end_with?('s') ? 'ES' : 'S'
69
- member = "#{sch.to_s.upcase}#{s}".to_sym
70
- self.const_get member
69
+ member = "#{sch.upcase}#{s}".to_sym
70
+
71
+ begin
72
+ self.const_get member
73
+ rescue NameError
74
+ raise ArgumentError.new "Unknown Supplied scheme #{sch}."
75
+ end
71
76
  end
72
77
 
73
78
  private
@@ -1,3 +1,3 @@
1
1
  module Rtl
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rtl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abdullah Barrak (abarrak)