rtl 0.2.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -2
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +14 -2
- data/CHANGELOG +15 -0
- data/Gemfile.lock +30 -0
- data/README.md +33 -10
- data/lib/rtl/core.rb +6 -6
- data/lib/rtl/version.rb +1 -1
- data/rtl.gemspec +6 -4
- metadata +30 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5e055b33f0f22f0d73a351fe4586c5ac6389dbb72bb2192d24dd099b219caa1f
|
4
|
+
data.tar.gz: 2900b4358d80b800f4a1a453fe6b47934020c23d3a91bde06ed026103cb1e079
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26c87c6f7bd897b3f4105845ac515a0d052aeb34a28b321f69112ca7cacd106eb7186c114c6b95ea489daef193caee22670ca23e398eb60d6c6cbf55ea6c642c
|
7
|
+
data.tar.gz: 7580427b3b521a0b3c0fadb7b87ef98e275fad3b61fbaab825b0af65842279fd251168b85bb5a2c6ab4b4c5b8fda430732ac6d97fb6b07d1f5ada010e98faf3e
|
data/.gitignore
CHANGED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rtl
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.7.3
|
data/.travis.yml
CHANGED
@@ -1,6 +1,18 @@
|
|
1
1
|
sudo: false
|
2
2
|
language: ruby
|
3
3
|
rvm:
|
4
|
-
- 2.
|
4
|
+
- 2.5.0
|
5
|
+
- 2.6.0
|
6
|
+
- 2.7.0
|
7
|
+
- 3.0.0
|
5
8
|
cache: bundler
|
6
|
-
before_install: gem install bundler -v
|
9
|
+
before_install: gem install bundler -v 2.2.20
|
10
|
+
install: bundle install --jobs=3 --retry=3
|
11
|
+
before_script:
|
12
|
+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
13
|
+
- chmod +x ./cc-test-reporter
|
14
|
+
- ./cc-test-reporter before-build
|
15
|
+
script:
|
16
|
+
- bundle exec rake test
|
17
|
+
after_script:
|
18
|
+
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
data/CHANGELOG
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# RTL Gem Changelog
|
2
|
+
|
3
|
+
## [0.4.0] - 2021-07-24
|
4
|
+
- Make querying by :all criteria as the default for convenience instead of iso_code only [@abarrak](https://github.com/abarrak).
|
5
|
+
- Bug fix on error reporting in case incorrect scheme option is passed [@abarrak](https://github.com/abarrak).
|
6
|
+
|
7
|
+
|
8
|
+
## [0.3.0] - 2021-07-24
|
9
|
+
- Update development dependencies to latest versions [@abarrak](https://github.com/abarrak).
|
10
|
+
|
11
|
+
## [0.2.4] - 2019-03-1
|
12
|
+
- Add support for Urdu [@benwbrum](https://github.com/benwbrum).
|
13
|
+
|
14
|
+
## [v0.2.3] - 2016-10-3
|
15
|
+
- Initial release [@abarrak](https://github.com/abarrak).
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
rtl (0.3.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
docile (1.4.0)
|
10
|
+
minitest (5.14.4)
|
11
|
+
rake (13.0.6)
|
12
|
+
simplecov (0.21.2)
|
13
|
+
docile (~> 1.1)
|
14
|
+
simplecov-html (~> 0.11)
|
15
|
+
simplecov_json_formatter (~> 0.1)
|
16
|
+
simplecov-html (0.12.3)
|
17
|
+
simplecov_json_formatter (0.1.3)
|
18
|
+
|
19
|
+
PLATFORMS
|
20
|
+
ruby
|
21
|
+
|
22
|
+
DEPENDENCIES
|
23
|
+
bundler (~> 2.2.20)
|
24
|
+
minitest (~> 5)
|
25
|
+
rake (~> 13)
|
26
|
+
rtl!
|
27
|
+
simplecov (~> 0.21)
|
28
|
+
|
29
|
+
BUNDLED WITH
|
30
|
+
2.2.24
|
data/README.md
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
# RTL
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/rtl.svg)](https://rubygems.org/gems/rtl)
|
2
3
|
[![Build Status](https://travis-ci.org/abarrak/rtl.svg?branch=master)](https://travis-ci.org/abarrak/rtl)
|
4
|
+
[![Test Coverage](https://api.codeclimate.com/v1/badges/e6e976b150ddabbc4665/test_coverage)](https://codeclimate.com/github/abarrak/rtl/test_coverage)
|
5
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/e6e976b150ddabbc4665/maintainability)](https://codeclimate.com/github/abarrak/rtl/maintainability)
|
3
6
|
|
4
|
-
This gem helps you
|
7
|
+
This gem helps you check whether a language direction is right-to-left (RTL) or left-to-right (LTR) implicitly, by supplying its full name, iso code, or other options.
|
5
8
|
|
6
9
|
## Installation
|
7
10
|
|
@@ -25,42 +28,62 @@ $ gem install rtl
|
|
25
28
|
|
26
29
|
## Usage
|
27
30
|
|
31
|
+
#### Query a language by string or symbol:
|
32
|
+
|
28
33
|
```ruby
|
29
34
|
require 'rtl'
|
30
35
|
|
31
|
-
# Query a language by string or symbol.
|
32
36
|
Rtl.rtl? 'ar' #=> true
|
33
37
|
Rtl.rtl? :ara #=> true
|
38
|
+
```
|
34
39
|
|
40
|
+
#### Query a language by ISO 639 code, (the default) ..
|
35
41
|
|
36
|
-
|
42
|
+
```ruby
|
37
43
|
Rtl.rtl? :syc, :iso_code #=> true
|
38
44
|
Rtl.rtl? :eng #=> false
|
45
|
+
```
|
39
46
|
|
47
|
+
#### Or by ISO 15924 code ..
|
40
48
|
|
41
|
-
|
49
|
+
```ruby
|
42
50
|
Rtl.rtl? 'Hung', :iso_long_code #=> true
|
51
|
+
```
|
43
52
|
|
53
|
+
#### Or by ISO number ..
|
44
54
|
|
45
|
-
|
55
|
+
```ruby
|
46
56
|
Rtl.rtl? 130, :iso_number #=> true
|
57
|
+
```
|
47
58
|
|
48
|
-
|
49
|
-
|
59
|
+
#### Or by unicode alias ..
|
60
|
+
```ruby
|
50
61
|
Rtl.rtl? 'Hebrew', :unicode_alias #=> true
|
62
|
+
```
|
51
63
|
|
64
|
+
#### Or by full name ..
|
52
65
|
|
53
|
-
|
66
|
+
```ruby
|
54
67
|
Rtl.rtl? :Persian, :full_name #=> true
|
68
|
+
```
|
69
|
+
|
70
|
+
#### Or check all ways ..
|
71
|
+
|
72
|
+
```ruby
|
73
|
+
Rtl.rtl? :kur, :all #=> true
|
74
|
+
```
|
75
|
+
|
76
|
+
Which is the default, in case no scheme criteria is specified.
|
77
|
+
|
55
78
|
|
79
|
+
#### Get List of all languages by any of the above criteria:
|
56
80
|
|
57
|
-
|
81
|
+
```ruby
|
58
82
|
Rtl.rtl_languages
|
59
83
|
#=> ["ar", "ara", "arc", "ae", "ave", "egy", "he", "heb", "nqo", "pal", "phn", "sam", "syc", "syr", "fa", "per", "fas", "ku", "kur"]
|
60
84
|
|
61
85
|
Rtl.rtl_languages :iso_long_code
|
62
86
|
#=> ...
|
63
|
-
|
64
87
|
```
|
65
88
|
|
66
89
|
## Useful Links
|
data/lib/rtl/core.rb
CHANGED
@@ -9,12 +9,12 @@ module Rtl
|
|
9
9
|
"Inscriptional Pahlavi", "Psalter Pahlavi", "Book Pahlavi", "Phoenician",
|
10
10
|
"Inscriptional Parthian", "Samaritan", "Old South Arabian", "Syriac",
|
11
11
|
"Syriac (Estrangelo variant)", "Syriac (Western variant)",
|
12
|
-
"Syriac (Eastern variant)", "Thaana", "Woleai", "Persian", "Kurdish"]
|
12
|
+
"Syriac (Eastern variant)", "Thaana", "Woleai", "Persian", "Kurdish", "Urdu"]
|
13
13
|
|
14
14
|
# ISO 639 codes for RTL languages.
|
15
15
|
# If a language has 639-1 and 639-2 codes, both are included.
|
16
16
|
ISO_CODES = ["ar", "ara", "arc", "ae", "ave", "egy", "he", "heb", "nqo", "pal", "phn", "sam",
|
17
|
-
"syc", "syr", "fa", "per", "fas", "ku", "kur"]
|
17
|
+
"syc", "syr", "fa", "per", "fas", "ku", "kur", "ur", "urd"]
|
18
18
|
|
19
19
|
# ISO 15924 codes for RTL languages.
|
20
20
|
ISO_LONG_CODES = ['Adlm', 'Arab', 'Aran', 'Armi', 'Avst', 'Cprt', 'Egyd', 'Egyh', 'Hatr',
|
@@ -40,7 +40,7 @@ module Rtl
|
|
40
40
|
"Thaana"]
|
41
41
|
|
42
42
|
# Query whether a language is rtl or not.
|
43
|
-
def self.rtl? language, scheme = :
|
43
|
+
def self.rtl? language, scheme = :all
|
44
44
|
sch = scheme.to_sym
|
45
45
|
l = language.to_s.strip
|
46
46
|
|
@@ -56,9 +56,9 @@ module Rtl
|
|
56
56
|
when :full_name
|
57
57
|
self.full_names l
|
58
58
|
when :all
|
59
|
-
all l
|
59
|
+
self.all l
|
60
60
|
else
|
61
|
-
raise ArgumentError.new "Unknown
|
61
|
+
raise ArgumentError.new "Unknown scheme value #{scheme}."
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
@@ -71,7 +71,7 @@ module Rtl
|
|
71
71
|
begin
|
72
72
|
self.const_get member
|
73
73
|
rescue NameError
|
74
|
-
raise ArgumentError.new "Unknown Supplied scheme #{
|
74
|
+
raise ArgumentError.new "Unknown Supplied scheme #{scheme}."
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
data/lib/rtl/version.rb
CHANGED
data/rtl.gemspec
CHANGED
@@ -2,11 +2,12 @@
|
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
4
|
require 'rtl/version'
|
5
|
+
require 'date'
|
5
6
|
|
6
7
|
Gem::Specification.new do |spec|
|
7
8
|
spec.name = "rtl"
|
8
9
|
spec.version = Rtl::VERSION
|
9
|
-
spec.date =
|
10
|
+
spec.date = Date.today.to_s
|
10
11
|
spec.authors = ["Abdullah Barrak (abarrak)"]
|
11
12
|
spec.email = ["a@abarrak.com"]
|
12
13
|
|
@@ -23,7 +24,8 @@ Gem::Specification.new do |spec|
|
|
23
24
|
|
24
25
|
spec.require_paths = ["lib"]
|
25
26
|
|
26
|
-
spec.add_development_dependency "bundler", "~>
|
27
|
-
spec.add_development_dependency "rake", "~>
|
28
|
-
spec.add_development_dependency "minitest", "~> 5
|
27
|
+
spec.add_development_dependency "bundler", "~> 2.2.20"
|
28
|
+
spec.add_development_dependency "rake", "~> 13"
|
29
|
+
spec.add_development_dependency "minitest", "~> 5"
|
30
|
+
spec.add_development_dependency "simplecov", "~> 0.21"
|
29
31
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rtl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Abdullah Barrak (abarrak)
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,42 +16,56 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 2.2.20
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 2.2.20
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '13'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '13'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '5
|
47
|
+
version: '5'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '5
|
54
|
+
version: '5'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: simplecov
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.21'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.21'
|
55
69
|
description: |-
|
56
70
|
RTL helps you to check whether a language direction is right-to-left (RTL)
|
57
71
|
or left-to-right (LTR) implicitly, by supplying its full name, iso code,
|
@@ -63,8 +77,12 @@ extensions: []
|
|
63
77
|
extra_rdoc_files: []
|
64
78
|
files:
|
65
79
|
- ".gitignore"
|
80
|
+
- ".ruby-gemset"
|
81
|
+
- ".ruby-version"
|
66
82
|
- ".travis.yml"
|
83
|
+
- CHANGELOG
|
67
84
|
- Gemfile
|
85
|
+
- Gemfile.lock
|
68
86
|
- LICENSE.txt
|
69
87
|
- README.md
|
70
88
|
- Rakefile
|
@@ -76,7 +94,7 @@ homepage: https://github.com/abarrak/rtl
|
|
76
94
|
licenses:
|
77
95
|
- MIT
|
78
96
|
metadata: {}
|
79
|
-
post_install_message:
|
97
|
+
post_install_message:
|
80
98
|
rdoc_options: []
|
81
99
|
require_paths:
|
82
100
|
- lib
|
@@ -91,9 +109,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
109
|
- !ruby/object:Gem::Version
|
92
110
|
version: '0'
|
93
111
|
requirements: []
|
94
|
-
|
95
|
-
|
96
|
-
signing_key:
|
112
|
+
rubygems_version: 3.1.6
|
113
|
+
signing_key:
|
97
114
|
specification_version: 4
|
98
115
|
summary: A gem for checking RTL direction of a language.
|
99
116
|
test_files: []
|