iuliia 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/spec.yml +1 -3
- data/.rubocop_todo.yml +2 -2
- data/CHANGELOG.md +10 -0
- data/Gemfile +1 -1
- data/README.md +41 -2
- data/{iiulia-rb.gemspec → iiulia.gemspec} +1 -1
- data/lib/iuliia.rb +1 -0
- data/lib/iuliia/exceptions.rb +11 -0
- data/lib/iuliia/iuliia.rb +7 -3
- data/lib/iuliia/schema.rb +6 -3
- data/lib/iuliia/translit.rb +4 -1
- data/lib/iuliia/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 687b0bb708b6eb6c64d055562c7e6be0b61a901c466b1bced4d7e0b4201cff1f
|
4
|
+
data.tar.gz: 9d45eb3171cbb1e21f43bc56dd6aa286f3425d884088a5f41ec51debaaa38e1e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d35bd6868e309f3887fc61d1e8c4944523dd0f5560dfe0763c56171045ff99c8f93c57ce3142c4d769aa0fa6cd52b71c244f02c26579b66a7389c2621d3324cf
|
7
|
+
data.tar.gz: f167b6d8d86029dd462724d75483ba6d281e1e478491fb20dbd1e0e2eccc6690db33cc4658b996a57e0bdda9d33da4939cc368c477221338448580c94e24ddf4
|
data/.github/workflows/spec.yml
CHANGED
@@ -17,9 +17,7 @@ on:
|
|
17
17
|
|
18
18
|
jobs:
|
19
19
|
test:
|
20
|
-
|
21
20
|
runs-on: ubuntu-latest
|
22
|
-
|
23
21
|
steps:
|
24
22
|
- uses: actions/checkout@v2
|
25
23
|
with:
|
@@ -31,4 +29,4 @@ jobs:
|
|
31
29
|
- name: Install dependencies
|
32
30
|
run: bundle install
|
33
31
|
- name: Run tests
|
34
|
-
run: bundle exec
|
32
|
+
run: bundle exec rspec
|
data/.rubocop_todo.yml
CHANGED
@@ -11,10 +11,10 @@
|
|
11
11
|
# Include: **/*.gemspec
|
12
12
|
Gemspec/RequiredRubyVersion:
|
13
13
|
Exclude:
|
14
|
-
- 'iiulia
|
14
|
+
- 'iiulia.gemspec'
|
15
15
|
|
16
16
|
# Offense count: 1
|
17
17
|
# Configuration parameters: MinBodyLength.
|
18
18
|
Style/GuardClause:
|
19
19
|
Exclude:
|
20
|
-
- 'iiulia
|
20
|
+
- 'iiulia.gemspec'
|
data/CHANGELOG.md
CHANGED
@@ -4,9 +4,19 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
+
## [1.0.1] - 2020-09-25
|
8
|
+
#### Deprecations
|
9
|
+
Method `translit` now deprecated, use `translate` instead. Will be removed completely in the future releases.
|
10
|
+
#### Improvements
|
11
|
+
Now call for translate with wrong (non-existent) schema will throw more human-friendly exception.
|
12
|
+
|
7
13
|
## [1.0.0] - 2020-09-14
|
8
14
|
This is the new initial version for gem `iuliia` after renaming it from `iuliia-rb`
|
9
15
|
|
16
|
+
## [0.2.1] - 2020-09-14
|
17
|
+
Changes:
|
18
|
+
* Gem has been renamed to `iuliia`. This is the last version of `iuliia-rb`. Please, use `iuliia` instead.
|
19
|
+
|
10
20
|
## [0.2.0] - 2020-09-14
|
11
21
|
Changes:
|
12
22
|
* Moved `lib/schemas` to the git submodule `github.com/nalgeon/iuliia`
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -6,6 +6,8 @@ Small gem to properly transliterate cyrillic to latin. Use https://github.com/na
|
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
9
|
+
#### Gem has been renamed to `iuliia`. This is the last version of `iuliia-rb`. Please, use `iuliia` instead.
|
10
|
+
|
9
11
|
Add this line to your application's Gemfile:
|
10
12
|
|
11
13
|
```ruby
|
@@ -60,7 +62,7 @@ Iuliia::Schema.available_schemas
|
|
60
62
|
Pick one and transliterate
|
61
63
|
|
62
64
|
```ruby
|
63
|
-
Iuliia.
|
65
|
+
Iuliia.translate('Юлия, съешь ещё этих мягких французских булок из Йошкар-Олы, да выпей алтайского чаю', schema: 'mvd_782')
|
64
66
|
|
65
67
|
"Yuliya, syesh' eshche etikh myagkikh frantsuzskikh bulok iz Yoshkar-Oly, da vypey altayskogo chayu"
|
66
68
|
```
|
@@ -73,10 +75,47 @@ Iuliia.translit('Юлия, съешь ещё этих мягких францу
|
|
73
75
|
|
74
76
|
## Development
|
75
77
|
|
76
|
-
|
78
|
+
Check out repo:
|
79
|
+
|
80
|
+
```
|
81
|
+
git clone git@github.com:adnikiforov/iuliia-rb.git
|
82
|
+
```
|
83
|
+
|
84
|
+
Check out submodule with schemas:
|
85
|
+
|
86
|
+
```
|
87
|
+
git submodule update --init
|
88
|
+
```
|
89
|
+
|
90
|
+
Setup dependencies:
|
91
|
+
|
92
|
+
```
|
93
|
+
bin/setup
|
94
|
+
```
|
95
|
+
|
96
|
+
Run specs:
|
97
|
+
|
98
|
+
```
|
99
|
+
bundle exec rspec
|
100
|
+
```
|
101
|
+
|
102
|
+
Or open console to try it:
|
103
|
+
|
104
|
+
```
|
105
|
+
bin/console
|
106
|
+
```
|
77
107
|
|
78
108
|
To install this gem onto your local machine, run `bundle exec rake install`.
|
79
109
|
|
110
|
+
## Support
|
111
|
+
|
112
|
+
<p>
|
113
|
+
<a href="https://evrone.com/?utm_source=github&utm_campaign=iuliia-rb">
|
114
|
+
<img src="https://raw.githubusercontent.com/adnikiforov/iuliia-rb/master/priv/evrone-sponsored-logo.png"
|
115
|
+
alt="Sponsored by Evrone" width="210">
|
116
|
+
</a>
|
117
|
+
</p>
|
118
|
+
|
80
119
|
## License
|
81
120
|
|
82
121
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
|
|
27
27
|
# Specify which files should be added to the gem when it is released.
|
28
28
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
29
29
|
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
30
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
30
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|priv)/}) }
|
31
31
|
end
|
32
32
|
spec.bindir = 'exe'
|
33
33
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
data/lib/iuliia.rb
CHANGED
data/lib/iuliia/iuliia.rb
CHANGED
@@ -2,13 +2,17 @@
|
|
2
2
|
|
3
3
|
module Iuliia
|
4
4
|
class << self
|
5
|
-
|
6
|
-
# Translit cyrillic string to latin representation
|
5
|
+
# Translate cyrillic string to latin representation
|
7
6
|
# @param string [String]
|
8
7
|
# @param schema [Iuliia::Schema]
|
9
8
|
# @return [String]
|
10
|
-
def
|
9
|
+
def translate(string, schema:)
|
11
10
|
Iuliia::Translit.new(string, schema).translit
|
12
11
|
end
|
12
|
+
|
13
|
+
def translit(string, schema:)
|
14
|
+
warn 'translit is deprecated, use .translate instead'
|
15
|
+
translate(string, schema: schema)
|
16
|
+
end
|
13
17
|
end
|
14
18
|
end
|
data/lib/iuliia/schema.rb
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
module Iuliia
|
4
4
|
module Schema
|
5
5
|
class << self
|
6
|
-
|
7
6
|
# Fetch schema by schema name
|
8
7
|
# @param schema_name [String]
|
9
8
|
# @return [Iuliia::Schema]
|
@@ -11,10 +10,11 @@ module Iuliia
|
|
11
10
|
schemas[schema_name]
|
12
11
|
end
|
13
12
|
|
13
|
+
# @deprecated
|
14
14
|
alias schema []
|
15
15
|
|
16
16
|
# Return list of available schemas
|
17
|
-
# @return [Array
|
17
|
+
# @return [Array]
|
18
18
|
def available_schemas
|
19
19
|
load_schemas.transform_values(&:description).to_a
|
20
20
|
end
|
@@ -26,7 +26,10 @@ module Iuliia
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def load_schema(name)
|
29
|
-
|
29
|
+
filename = "lib/schemas/#{name}.json"
|
30
|
+
raise Exceptions::NonExistentSchemaException unless File.exist?(filename)
|
31
|
+
|
32
|
+
JSON.parse(File.read(filename), object_class: OpenStruct, symbolize_names: true)
|
30
33
|
end
|
31
34
|
|
32
35
|
def load_schemas
|
data/lib/iuliia/translit.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
module Iuliia
|
4
4
|
class Translit
|
5
5
|
ENDING_LENGTH = 2
|
6
|
+
private_constant :ENDING_LENGTH
|
6
7
|
|
7
8
|
# Initialize transliterator engine with string and schema
|
8
9
|
# @param string [String]
|
@@ -10,12 +11,14 @@ module Iuliia
|
|
10
11
|
# @return [Iuliia::Translit]
|
11
12
|
def initialize(string, schema)
|
12
13
|
@string = string
|
13
|
-
@schema = Iuliia::Schema
|
14
|
+
@schema = Iuliia::Schema[schema]
|
14
15
|
end
|
15
16
|
|
16
17
|
# Translit cyrillic string to latin representation
|
17
18
|
# @return [String]
|
18
19
|
def translit
|
20
|
+
return unless schema
|
21
|
+
|
19
22
|
string.split(/\b/).map { |chunk| translit_chunk(chunk) }.join
|
20
23
|
end
|
21
24
|
|
data/lib/iuliia/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iuliia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey Nikiforov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-09-
|
11
|
+
date: 2020-09-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -101,8 +101,9 @@ files:
|
|
101
101
|
- Rakefile
|
102
102
|
- bin/console
|
103
103
|
- bin/setup
|
104
|
-
- iiulia
|
104
|
+
- iiulia.gemspec
|
105
105
|
- lib/iuliia.rb
|
106
|
+
- lib/iuliia/exceptions.rb
|
106
107
|
- lib/iuliia/iuliia.rb
|
107
108
|
- lib/iuliia/schema.rb
|
108
109
|
- lib/iuliia/translit.rb
|