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 +4 -4
- data/README.md +44 -1
- data/lib/rtl/core.rb +7 -2
- data/lib/rtl/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a86faa9860088b875b32f4c1d5c3338992e21d6
|
4
|
+
data.tar.gz: 33a7f7dbbc882768b3a028e36398ccb38bfe8d8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
|
data/lib/rtl/core.rb
CHANGED
@@ -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.
|
70
|
-
|
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
|
data/lib/rtl/version.rb
CHANGED