byk 1.0.0 → 1.1.0

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.
Files changed (6) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +5 -0
  3. data/README.md +51 -101
  4. data/ext/byk/byk.c +1 -2
  5. data/lib/byk/version.rb +1 -1
  6. metadata +28 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: cc996c9d9dc81f884e02cc1dd760eeb57b6545fc
4
- data.tar.gz: de07860c2cb41bcb39b299fee4500fd2bf01db73
2
+ SHA256:
3
+ metadata.gz: 5cb843eb31c5c618dc10608759b5668bd8db46eb38911381bacd693f9b4635bf
4
+ data.tar.gz: '0085a83cbf114273d5fc9b64cca6d8d4c19542a36614eb8d89c80eb0b036176f'
5
5
  SHA512:
6
- metadata.gz: 16e97855924c380b205e2e651fdcde391785fe051c2971d948f801ff4260eb691dc4c3304ac17b3083fc0a2469f26d134c9622f74b058f6950d5fd8dfaf62383
7
- data.tar.gz: c85659aaaccbc5e1db30305b52e2f4955de160dcb7a617ae564877619fe5f36d852ea7c17228f301e639aae3d4793133baa5d644faeffc83942d6b179bef53e9
6
+ metadata.gz: 4fc4c750b29da3cf64b5d0cea0275f41e7f5cae4192a223e0d1f344505e8ab6c045b1b772f29d954ca4310062b9ff7ac1b07d1d6dc17a5c6d8969f03f7f94340
7
+ data.tar.gz: f8909c3816411619ca8a2239b07d0bc9aa48663ac5395f4a8d6fd6735d5c8f252ff98977dcba970b5a3c21eae9bf55f63fd40e75ad0918f4f670a5e2b24ca239
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ### Byk 1.1.0 (2022-02-02)
4
+
5
+ * Removed string tainting, it is deprecated and planned for removal
6
+ * Upgraded development dependencies and required Ruby version
7
+
3
8
  ### Byk 1.0.0 (2016-04-09)
4
9
 
5
10
  * Introduced `#to_cyrillic` and `#to_cyrillic!`
data/README.md CHANGED
@@ -2,42 +2,41 @@ Byk
2
2
  ===
3
3
 
4
4
  [![Gem Version](https://badge.fury.io/rb/byk.svg)](https://rubygems.org/gems/byk)
5
- [![Build Status](https://travis-ci.org/topalovic/byk.svg?branch=master)](https://travis-ci.org/topalovic/byk)
5
+ [![tests](https://github.com/topalovic/byk/actions/workflows/tests.yml/badge.svg)](https://github.com/topalovic/byk/actions/workflows/tests.yml)
6
6
 
7
- Ruby gem for fast transliteration of Serbian Cyrillic Latin
7
+ Руби пакет за брзо пресловљавање ћирилице у латиницу и обратно
8
8
 
9
9
  ![byk](https://cloud.githubusercontent.com/assets/626128/7155207/07545960-e35d-11e4-804e-5fdee70a3e30.png)
10
10
 
11
+ [[English, please!](README.en.md)]
11
12
 
12
- ## Installation
13
+ ## Инсталација
13
14
 
14
- Byk can be used as a standalone console utility or as a `String`
15
- extension in your Ruby programs. It has zero dependencies beyond
16
- vanilla Ruby and the toolchain for building native gems <sup>1</sup>.
15
+ Byk се може користити као самостални конзолни алат или као `String` додатак у Руби програмима. Не зависи ни од каквих пакета поред програмског језика Руби и стандардних алата за компајлирање <sup>1</sup>.
17
16
 
18
- You can install it directly:
17
+ Можеш га инсталирати директно:
19
18
 
20
19
  ```ruby
21
20
  $ gem install byk
22
21
  ```
23
22
 
24
- or add it as a dependency in your application's Gemfile:
23
+ или додати у `Gemfile` своје апликације:
25
24
 
26
25
  ```ruby
27
26
  gem "byk"
28
27
  ```
29
28
 
30
- <sub><sup>1</sup> For Windows, you might want to check out
31
- [DevKit](https://github.com/oneclick/rubyinstaller/wiki/Development-Kit)</sub>
29
+ <sub><sup>1</sup> За Windows, види [DevKit](https://github.com/oneclick/rubyinstaller/wiki/Development-Kit)</sub>
32
30
 
33
31
 
34
- ## Usage
32
+ ## Употреба
35
33
 
36
- ### As a standalone utility
34
+ ### Као самостални алат
37
35
 
38
- Here's the help banner with all the available options:
36
+ Ево прегледа могућности конзолног алата:
39
37
 
40
38
  ```
39
+ $ byk --help
41
40
  usage: byk [options] [files]
42
41
 
43
42
  options:
@@ -47,26 +46,15 @@ options:
47
46
  -v, --version show version
48
47
  ```
49
48
 
50
- Translation goes to stdout so you can redirect it or pipe it as you
51
- see fit. Let's take a look at some common scenarios.
49
+ За превод лету", проследи текст команди:
52
50
 
53
- To translate files to Cyrillic:
54
51
  ```sh
55
- $ byk in1.txt in2.txt > out.txt
56
- ```
57
-
58
- To translate files to Latin and search for a phrase:
59
- ```sh
60
- $ byk -l file.txt | grep stvar
61
- ```
62
-
63
- Ad hoc conversion:
64
- ```sh
65
- $ echo "Вук Стефановић Караџић" | byk -a
52
+ $ byk -a <<< "Вук Стефановић Караџић"
66
53
  Vuk Stefanovic Karadzic
67
54
  ```
68
55
 
69
- or simply omit args and type away:
56
+ Алтернативно, позови команду, унеси текст за превод и обележи крај уноса помоћу <kbd>Ctrl</kbd> <kbd>D</kbd>:
57
+
70
58
  ```sh
71
59
  $ byk
72
60
  a u ruke Mandušića Vuka
@@ -76,127 +64,89 @@ biće svaka puška ubojita!
76
64
  биће свака пушка убојита!
77
65
  ```
78
66
 
79
- `^D` being <kbd>ctrl</kbd> <kbd>d</kbd>.
67
+ Превод се шаље на стандардни излаз, те га можеш преусмерити по потреби. На пример, за превод текстуалне датотеке на ћирилицу и чување превода:
68
+
69
+ ```sh
70
+ $ byk lat.txt > cir.txt
71
+ ```
80
72
 
81
73
 
82
- ### As a `String` extension
74
+ ### Као `String` додатак
83
75
 
84
- Unless you're using Bundler, make sure to require the gem in your
85
- initializer:
76
+ У случају да не користиш Bundler, увези пакет "ручно":
86
77
 
87
78
  ```ruby
88
79
  require "byk"
89
80
  ```
90
81
 
91
- This will extend `String` with a couple of simple methods:
82
+ што ће проширити `String` новим методама:
92
83
 
93
84
  ```ruby
94
- "Šeširdžija".to_cyrillic # => "Шеширџија"
95
- "Шеширџија".to_latin # => "Šeširdžija"
96
- "Шеширџија".to_ascii_latin # => "Sesirdzija"
85
+ "Šeširdžija".to_cyrillic #=> "Шеширџија"
86
+ "Шеширџија".to_latin #=> "Šeširdžija"
87
+ "Шеширџија".to_ascii_latin #=> "Sesirdzija"
97
88
  ```
98
89
 
99
- These do not modify the receiver. For that, there's a destructive
100
- variant of each:
90
+ и њиховим деструктивним верзијама:
101
91
 
102
92
  ```ruby
103
93
  text = "Šeširdžija"
104
- text.to_cyrillic! # => "Шеширџија"
105
- text.to_latin! # => "Šeširdžija"
106
- text.to_ascii_latin! # => "Sesirdzija"
107
- text # => "Sesirdzija"
94
+ text.to_ascii_latin! #=> "Sesirdzija"
95
+ text #=> "Sesirdzija"
108
96
  ```
109
97
 
110
- Note that both latinization methods observe
111
- [digraph capitalization rules](http://sr.wikipedia.org/wiki/Гајица#.D0.94.D0.B8.D0.B3.D1.80.D0.B0.D1.84.D0.B8):
112
-
113
- ```ruby
114
- "ЉИЉА Љиљановић".to_latin # => "LJILJA Ljiljanović"
115
- "ĐORĐE Đorđević".to_ascii_latin # => "DJORDJE Djordjevic"
116
- ```
117
-
118
-
119
- ### Safe require
120
-
121
- If you prefer not to monkey patch `String`, you can do a "safe"
122
- require in your Gemfile:
98
+ #### "Безбедан" увоз
123
99
 
100
+ У случају да не желиш да проширујеш `String`, можеш извршити "безбедан" увоз:
124
101
 
125
102
  ```ruby
126
- gem "byk", :require => "byk/safe"
127
- ```
103
+ # унутар Gemfile-а:
104
+ gem "byk", require: "byk/safe"
128
105
 
129
- or initializer:
130
-
131
- ```ruby
106
+ # иначе:
132
107
  require "byk/safe"
133
108
  ```
134
109
 
135
- Then, you should rely on module methods:
110
+ па се ослонити на методе модула:
136
111
 
137
112
  ```ruby
138
- text = "Жвазбука"
139
-
140
- Byk.to_latin(text) # => "Žvazbuka"
141
- text # => "Жвазбука"
142
-
143
- Byk.to_latin!(text) # => "Žvazbuka"
144
- text # => "Žvazbuka"
145
-
146
- # etc.
113
+ Byk.to_latin("Жвазбука") #=> "Žvazbuka"
147
114
  ```
148
115
 
149
116
 
150
- ## How fast is "fast" transliteration?
117
+ ## Напомене
151
118
 
152
- Here's a quick test:
119
+ Ретки случајеви диграфа које треба сачувати код превођења у ћирилицу нису узети у разматрање: _Танјуг_, _надживети_ и слично.
153
120
 
154
- ```sh
155
- $ wget https://sr.wikipedia.org/ -O sample
156
- $ du -h sample
157
- 128K
121
+ С друге стране, методе за латинизацију исправно преводе [велике диграфе](http://sr.wikipedia.org/wiki/Гајица#.D0.94.D0.B8.D0.B3.D1.80.D0.B0.D1.84.D0.B8):
158
122
 
159
- $ time byk -l sample > /dev/null
160
- 0.08s user 0.04s system 96% cpu 0.126 total
123
+ ```ruby
124
+ "ЉИЉА Љ. Љиљановић".to_latin #=> "LJILJA Lj. Ljiljanović"
125
+ "ĐORĐE Đ. Đorđević".to_ascii_latin #=> "DJORDJE Dj. Djordjevic"
161
126
  ```
162
127
 
163
- Let's up the ante:
164
128
 
165
- ```sh
166
- $ for i in {1..800}; do cat sample; done > big
167
- $ du -h big
168
- 97M
129
+ ## Колико брзо је "брзо" пресловљавање?
169
130
 
170
- $ time byk -l big > /dev/null
171
- 1.71s user 0.13s system 99% cpu 1.846 total
172
- ```
131
+ Byk је [10-30x бржи](benchmark) од [наивне Руби имплементације](https://github.com/dejan/srbovanje), у зависности од састава улаза и смера превођења.
173
132
 
174
- So, ~100MB in under 2s. Fast enough, I suppose. You can expect it to
175
- scale linearly.
176
133
 
177
- Compared to the pure Ruby implementation, it is about
178
- [10-30x faster](benchmark), depending on the input composition and the
179
- transliteration method applied.
134
+ ## Тестирање
180
135
 
181
-
182
- ## Testing
183
-
184
- To test the gem, clone the repo and run:
136
+ Клонирај пројекат и покрени тестове:
185
137
 
186
138
  ```
187
139
  $ bundle && bundle exec rake
188
140
  ```
189
141
 
190
142
 
191
- ## Compatibility
192
-
193
- Byk is supported under MRI 1.9.2+. I might try my hand in writing a
194
- JRuby extension in a future release.
143
+ ## Компатибилност
195
144
 
145
+ Byk је подржан само на стандардном Рубију (MRI).
196
146
 
197
147
 
198
- ## License
148
+ ## Лиценца
199
149
 
200
- This gem is released under the [MIT License](LICENSE).
150
+ Овај пакет је објављен под [МИТ лиценцом](LICENSE).
201
151
 
202
152
  Уздравље!
data/ext/byk/byk.c CHANGED
@@ -278,8 +278,7 @@ str_to_srb(VALUE str, int strategy, int bang)
278
278
  rb_str_shared_replace(str, dest);
279
279
  }
280
280
  else {
281
- OBJ_INFECT(dest, str);
282
- str = dest;
281
+ str = dest;
283
282
  }
284
283
 
285
284
  return str;
data/lib/byk/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Byk
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: byk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nikola Topalović
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-04-09 00:00:00.000000000 Z
11
+ date: 2022-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -16,42 +16,56 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '10.5'
19
+ version: '13.0'
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: '10.5'
26
+ version: '13.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake-compiler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.9'
33
+ version: '1.1'
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: '0.9'
40
+ version: '1.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '3.2'
47
+ version: '3.10'
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: '3.2'
54
+ version: '3.10'
55
+ - !ruby/object:Gem::Dependency
56
+ name: benchmark-ips
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '2.9'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '2.9'
55
69
  description: Fast transliteration of Serbian Cyrillic to Latin and back. Brzo preslovljavanje
56
70
  ćirilice u latinicu i obratno.
57
71
  email: nikola.topalovic@gmail.com
@@ -76,7 +90,7 @@ homepage: https://github.com/topalovic/byk
76
90
  licenses:
77
91
  - MIT
78
92
  metadata: {}
79
- post_install_message:
93
+ post_install_message:
80
94
  rdoc_options: []
81
95
  require_paths:
82
96
  - lib
@@ -84,18 +98,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
84
98
  requirements:
85
99
  - - ">="
86
100
  - !ruby/object:Gem::Version
87
- version: 1.9.2
101
+ version: 2.2.0
88
102
  required_rubygems_version: !ruby/object:Gem::Requirement
89
103
  requirements:
90
104
  - - ">="
91
105
  - !ruby/object:Gem::Version
92
106
  version: '0'
93
107
  requirements: []
94
- rubyforge_project:
95
- rubygems_version: 2.5.1
96
- signing_key:
108
+ rubygems_version: 3.3.3
109
+ signing_key:
97
110
  specification_version: 4
98
- summary: Fast transliteration of Serbian Cyrillic to Latin and back. Brzo preslovljavanje
99
- ćirilice u latinicu i obratno.
111
+ summary: Transliteration of Serbian Cyrillic <-> Latin
100
112
  test_files:
101
113
  - spec/byk_spec.rb