grc 0.1.3 → 0.1.4

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
  SHA256:
3
- metadata.gz: 607b4978467b7021989bc97c470b46a97996a6e418dbacce9704e1827e87fb38
4
- data.tar.gz: f7058a951b8863b30edb9fe0e3c93e350782c7adee00ca018c806888e70ee2f1
3
+ metadata.gz: 548df19ff151d10d595c45a8d964e8b6d6b5eef701bf6fef730307a8307e73be
4
+ data.tar.gz: ba58fa1b46dcd84f2d39447358ab5f165110f1d4afb3e7b91630c271f80e4e2d
5
5
  SHA512:
6
- metadata.gz: ab9239b4caf50bd0813025a6fc7491a43d9e5e53f07d7eb50db49040089e19a0bebf603027c3ab0c9b5feaf22cc5f8613c7608d2b730bba035e855e79f281e4c
7
- data.tar.gz: 767f82f5519ce78f257a165bdfcf712d6f9d854c9dccb2e1d167cff6495635bcd71113e5087a3d7b2b79ba5c73a8ae0eab1791a0f303121231d4be88292dd08d
6
+ metadata.gz: 7332f28b7ec732a811560205874d824588515acf2ae367c767d9d7edb7ab715005394fd080b064280b72b34f1170873c890ab41550c69080bc39350ab4c8d2fe
7
+ data.tar.gz: 6bb907945e3bc1d5f2fedc6d099d2c8d5b9c32378a3168f323e7971f04873dcd55c9fa905fdb327d59070830fe2ec0273188e144ff6bba3340a374dd9f372ba1
data/.idea/grc.iml CHANGED
@@ -12,43 +12,53 @@
12
12
  <orderEntry type="jdk" jdkName="rbenv: 3.1.0" jdkType="RUBY_SDK" />
13
13
  <orderEntry type="sourceFolder" forTests="false" />
14
14
  <orderEntry type="library" scope="PROVIDED" name="ast (v2.4.2, rbenv: 3.1.0) [gem]" level="application" />
15
- <orderEntry type="library" scope="PROVIDED" name="bundler (v2.3.17, rbenv: 3.1.0) [gem]" level="application" />
15
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v2.3.22, rbenv: 3.1.0) [gem]" level="application" />
16
+ <orderEntry type="library" scope="PROVIDED" name="coveralls (v0.8.23, rbenv: 3.1.0) [gem]" level="application" />
17
+ <orderEntry type="library" scope="PROVIDED" name="docile (v1.4.0, rbenv: 3.1.0) [gem]" level="application" />
16
18
  <orderEntry type="library" scope="PROVIDED" name="json (v2.6.2, rbenv: 3.1.0) [gem]" level="application" />
17
- <orderEntry type="library" scope="PROVIDED" name="minitest (v5.16.2, rbenv: 3.1.0) [gem]" level="application" />
19
+ <orderEntry type="library" scope="PROVIDED" name="minitest (v5.16.3, rbenv: 3.1.0) [gem]" level="application" />
18
20
  <orderEntry type="library" scope="PROVIDED" name="parallel (v1.22.1, rbenv: 3.1.0) [gem]" level="application" />
19
- <orderEntry type="library" scope="PROVIDED" name="parser (v3.1.2.0, rbenv: 3.1.0) [gem]" level="application" />
21
+ <orderEntry type="library" scope="PROVIDED" name="parser (v3.1.2.1, rbenv: 3.1.0) [gem]" level="application" />
20
22
  <orderEntry type="library" scope="PROVIDED" name="rainbow (v3.1.1, rbenv: 3.1.0) [gem]" level="application" />
21
23
  <orderEntry type="library" scope="PROVIDED" name="rake (v13.0.6, rbenv: 3.1.0) [gem]" level="application" />
22
24
  <orderEntry type="library" scope="PROVIDED" name="regexp_parser (v2.5.0, rbenv: 3.1.0) [gem]" level="application" />
23
25
  <orderEntry type="library" scope="PROVIDED" name="rexml (v3.2.5, rbenv: 3.1.0) [gem]" level="application" />
24
- <orderEntry type="library" scope="PROVIDED" name="rubocop (v1.31.2, rbenv: 3.1.0) [gem]" level="application" />
25
- <orderEntry type="library" scope="PROVIDED" name="rubocop-ast (v1.19.1, rbenv: 3.1.0) [gem]" level="application" />
26
+ <orderEntry type="library" scope="PROVIDED" name="rubocop (v1.36.0, rbenv: 3.1.0) [gem]" level="application" />
27
+ <orderEntry type="library" scope="PROVIDED" name="rubocop-ast (v1.21.0, rbenv: 3.1.0) [gem]" level="application" />
26
28
  <orderEntry type="library" scope="PROVIDED" name="rubocop-minitest (v0.20.1, rbenv: 3.1.0) [gem]" level="application" />
27
29
  <orderEntry type="library" scope="PROVIDED" name="rubocop-rake (v0.6.0, rbenv: 3.1.0) [gem]" level="application" />
28
30
  <orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.11.0, rbenv: 3.1.0) [gem]" level="application" />
29
- <orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v2.2.0, rbenv: 3.1.0) [gem]" level="application" />
31
+ <orderEntry type="library" scope="PROVIDED" name="rubyzip (v2.3.2, rbenv: 3.1.0) [gem]" level="application" />
32
+ <orderEntry type="library" scope="PROVIDED" name="simplecov (v0.16.1, rbenv: 3.1.0) [gem]" level="application" />
33
+ <orderEntry type="library" scope="PROVIDED" name="simplecov-html (v0.10.2, rbenv: 3.1.0) [gem]" level="application" />
34
+ <orderEntry type="library" scope="PROVIDED" name="sync (v0.5.0, rbenv: 3.1.0) [gem]" level="application" />
35
+ <orderEntry type="library" scope="PROVIDED" name="term-ansicolor (v1.7.1, rbenv: 3.1.0) [gem]" level="application" />
36
+ <orderEntry type="library" scope="PROVIDED" name="thor (v1.2.1, rbenv: 3.1.0) [gem]" level="application" />
37
+ <orderEntry type="library" scope="PROVIDED" name="tins (v1.31.1, rbenv: 3.1.0) [gem]" level="application" />
38
+ <orderEntry type="library" scope="PROVIDED" name="unicode-data (v0.1.1, rbenv: 3.1.0) [gem]" level="application" />
39
+ <orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v2.3.0, rbenv: 3.1.0) [gem]" level="application" />
30
40
  <orderEntry type="library" scope="PROVIDED" name="unicode-name (v1.10.0, rbenv: 3.1.0) [gem]" level="application" />
31
- <orderEntry type="library" scope="PROVIDED" name="unicode-types (v1.7.0, rbenv: 3.1.0) [gem]" level="application" />
41
+ <orderEntry type="library" scope="PROVIDED" name="unicode-types (v1.8.0, rbenv: 3.1.0) [gem]" level="application" />
32
42
  </component>
33
43
  <component name="RakeTasksCache">
34
44
  <option name="myRootTask">
35
45
  <RakeTaskImpl id="rake">
36
46
  <subtasks>
37
- <RakeTaskImpl description="Build grc-0.1.0.gem into the pkg directory" fullCommand="build" id="build" />
47
+ <RakeTaskImpl description="Build grc-0.1.3.gem into the pkg directory" fullCommand="build" id="build" />
38
48
  <RakeTaskImpl id="build">
39
49
  <subtasks>
40
- <RakeTaskImpl description="Generate SHA512 checksum if grc-0.1.0.gem into the checksums directory" fullCommand="build:checksum" id="checksum" />
50
+ <RakeTaskImpl description="Generate SHA512 checksum if grc-0.1.3.gem into the checksums directory" fullCommand="build:checksum" id="checksum" />
41
51
  </subtasks>
42
52
  </RakeTaskImpl>
43
53
  <RakeTaskImpl description="Remove any temporary products" fullCommand="clean" id="clean" />
44
54
  <RakeTaskImpl description="Remove any generated files" fullCommand="clobber" id="clobber" />
45
- <RakeTaskImpl description="Build and install grc-0.1.0.gem into system gems" fullCommand="install" id="install" />
55
+ <RakeTaskImpl description="Build and install grc-0.1.3.gem into system gems" fullCommand="install" id="install" />
46
56
  <RakeTaskImpl id="install">
47
57
  <subtasks>
48
- <RakeTaskImpl description="Build and install grc-0.1.0.gem into system gems without network access" fullCommand="install:local" id="local" />
58
+ <RakeTaskImpl description="Build and install grc-0.1.3.gem into system gems without network access" fullCommand="install:local" id="local" />
49
59
  </subtasks>
50
60
  </RakeTaskImpl>
51
- <RakeTaskImpl description="Create tag v0.1.0 and build and push grc-0.1.0.gem to rubygems.org" fullCommand="release[remote]" id="release[remote]" />
61
+ <RakeTaskImpl description="Create tag v0.1.3 and build and push grc-0.1.3.gem to rubygems.org" fullCommand="release[remote]" id="release[remote]" />
52
62
  <RakeTaskImpl description="Run RuboCop" fullCommand="rubocop" id="rubocop" />
53
63
  <RakeTaskImpl id="rubocop">
54
64
  <subtasks>
data/.idea/workspace.xml CHANGED
@@ -4,9 +4,11 @@
4
4
  <option name="autoReloadType" value="SELECTIVE" />
5
5
  </component>
6
6
  <component name="ChangeListManager">
7
- <list default="true" id="0af4ebef-9f59-4a85-9f65-0d8163baa737" name="Changes" comment="2022-07-16-03-34">
7
+ <list default="true" id="0af4ebef-9f59-4a85-9f65-0d8163baa737" name="Changes" comment="experimenting with unicode/data, codepoints.">
8
+ <change beforePath="$PROJECT_DIR$/.idea/grc.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/grc.iml" afterDir="false" />
8
9
  <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
9
- <change beforePath="$PROJECT_DIR$/CHANGELOG.md" beforeDir="false" afterPath="$PROJECT_DIR$/CHANGELOG.md" afterDir="false" />
10
+ <change beforePath="$PROJECT_DIR$/Gemfile.lock" beforeDir="false" />
11
+ <change beforePath="$PROJECT_DIR$/lib/grc.rb" beforeDir="false" afterPath="$PROJECT_DIR$/lib/grc.rb" afterDir="false" />
10
12
  <change beforePath="$PROJECT_DIR$/lib/grc/version.rb" beforeDir="false" afterPath="$PROJECT_DIR$/lib/grc/version.rb" afterDir="false" />
11
13
  </list>
12
14
  <option name="SHOW_DIALOG" value="false" />
@@ -14,6 +16,13 @@
14
16
  <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
15
17
  <option name="LAST_RESOLUTION" value="IGNORE" />
16
18
  </component>
19
+ <component name="FileTemplateManagerImpl">
20
+ <option name="RECENT_TEMPLATES">
21
+ <list>
22
+ <option value="teeste" />
23
+ </list>
24
+ </option>
25
+ </component>
17
26
  <component name="Git.Settings">
18
27
  <option name="PUSH_TAGS">
19
28
  <GitPushTagMode>
@@ -21,8 +30,18 @@
21
30
  <option name="title" value="All" />
22
31
  </GitPushTagMode>
23
32
  </option>
33
+ <option name="RECENT_BRANCH_BY_REPOSITORY">
34
+ <map>
35
+ <entry key="$PROJECT_DIR$" value="dev" />
36
+ </map>
37
+ </option>
24
38
  <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
25
39
  </component>
40
+ <component name="HighlightingSettingsPerFile">
41
+ <setting file="file://$PROJECT_DIR$/Gemfile" root0="FORCE_HIGHLIGHTING" />
42
+ <setting file="file://$PROJECT_DIR$/grc.gemspec" root0="FORCE_HIGHLIGHTING" />
43
+ <setting file="file://$PROJECT_DIR$/lib/grc.rb" root0="FORCE_HIGHLIGHTING" />
44
+ </component>
26
45
  <component name="MarkdownSettingsMigration">
27
46
  <option name="stateVersion" value="1" />
28
47
  </component>
@@ -34,12 +53,14 @@
34
53
  </component>
35
54
  <component name="PropertiesComponent">{
36
55
  &quot;keyToString&quot;: {
56
+ &quot;Project.color&quot;: &quot;003853&quot;,
37
57
  &quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
38
58
  &quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
59
+ &quot;ToolWindowGitHub Copilot.ShowToolbar&quot;: &quot;false&quot;,
39
60
  &quot;last_opened_file_path&quot;: &quot;/Users/bcdav/Dropbox/Developer/Ruby/Gems/grc&quot;,
40
61
  &quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
41
62
  &quot;ruby.rails.projectView.checked&quot;: &quot;true&quot;,
42
- &quot;settings.editor.selected.configurable&quot;: &quot;preferences.pluginManager&quot;
63
+ &quot;settings.editor.selected.configurable&quot;: &quot;preferences.editor&quot;
43
64
  }
44
65
  }</component>
45
66
  <component name="RunManager" selected="Ruby.grc">
@@ -62,6 +83,19 @@
62
83
  <RUBY_RUN_CONFIG NAME="SCRIPT_ARGS" VALUE="" />
63
84
  <method v="2" />
64
85
  </configuration>
86
+ <configuration name="scratch_2" type="RubyRunConfigurationType" factoryName="Ruby" temporary="true">
87
+ <RUBY_RUN_CONFIG NAME="RUBY_ARGS" VALUE="" />
88
+ <RUBY_RUN_CONFIG NAME="WORK DIR" VALUE="$PROJECT_DIR$" />
89
+ <RUBY_RUN_CONFIG NAME="SHOULD_USE_SDK" VALUE="false" />
90
+ <RUBY_RUN_CONFIG NAME="ALTERN_SDK_NAME" VALUE="" />
91
+ <RUBY_RUN_CONFIG NAME="myPassParentEnvs" VALUE="true" />
92
+ <EXTENSION ID="BundlerRunConfigurationExtension" BUNDLE_MODE="AUTO" bundleExecEnabled="true" />
93
+ <EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
94
+ <EXTENSION ID="org.jetbrains.plugins.ruby.rails.run.RailsRunConfigurationExtension" SCRATCH_USE_RAILS_RUNNER="false" />
95
+ <RUBY_RUN_CONFIG NAME="SCRIPT_PATH" VALUE="$APPLICATION_CONFIG_DIR$/scratches/scratch_2.rb" />
96
+ <RUBY_RUN_CONFIG NAME="SCRIPT_ARGS" VALUE="" />
97
+ <method v="2" />
98
+ </configuration>
65
99
  <configuration name="test_grc.rb" type="TestUnitRunConfigurationType" factoryName="Test::Unit/Shoulda/Minitest" temporary="true" nameIsGenerated="true">
66
100
  <module name="grc" />
67
101
  <predefined_log_file enabled="true" id="RUBY_TESTUNIT" />
@@ -155,49 +189,21 @@
155
189
  <RTEST_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_OPTIONS" VALUE="" />
156
190
  <method v="2" />
157
191
  </configuration>
158
- <configuration name="test_unicode_name" type="TestUnitRunConfigurationType" factoryName="Test::Unit/Shoulda/Minitest" temporary="true" nameIsGenerated="true">
159
- <module name="grc" />
160
- <predefined_log_file enabled="true" id="RUBY_TESTUNIT" />
161
- <RTEST_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-Ilib:test" />
162
- <RTEST_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
163
- <RTEST_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
164
- <RTEST_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
165
- <RTEST_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
166
- <envs>
167
- <env name="JRUBY_OPTS" value="-X+O" />
168
- </envs>
169
- <EXTENSION ID="BundlerRunConfigurationExtension" BUNDLE_MODE="AUTO" bundleExecEnabled="true" />
170
- <EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
171
- <EXTENSION ID="RubyCoverageRunConfigurationExtension" track_test_folders="true" runner="rcov" ENABLE_BRANCH_COVERAGE="true" ENABLE_FORKED_COVERAGE="true">
172
- <COVERAGE_PATTERN ENABLED="true">
173
- <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
174
- </COVERAGE_PATTERN>
175
- </EXTENSION>
176
- <EXTENSION ID="org.jetbrains.plugins.ruby.rails.run.RailsRunConfigurationExtension" SCRATCH_USE_RAILS_RUNNER="false" />
177
- <RTEST_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
178
- <RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="$MODULE_DIR$/test/test_grc.rb" />
179
- <RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPTS_PATHS" VALUE="$MODULE_DIR$/test/test_grc.rb" />
180
- <RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="" />
181
- <RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_METHOD_NAME" VALUE="^test_unicode_name$" />
182
- <RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_METHOD" />
183
- <RTEST_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
184
- <RTEST_RUN_CONFIG_SETTINGS_ID NAME="ZEUS" VALUE="false" />
185
- <RTEST_RUN_CONFIG_SETTINGS_ID NAME="SPRING" VALUE="false" />
186
- <RTEST_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_OPTIONS" VALUE="" />
187
- <method v="2" />
188
- </configuration>
189
192
  <recent_temporary>
190
193
  <list>
191
- <item itemvalue="Ruby.grc" />
192
194
  <item itemvalue="Test::Unit/Shoulda/Minitest.test_tonos_to_oxia" />
193
195
  <item itemvalue="Test::Unit/Shoulda/Minitest.test_oxia_to_tonos" />
194
196
  <item itemvalue="Test::Unit/Shoulda/Minitest.test_grc.rb" />
195
- <item itemvalue="Test::Unit/Shoulda/Minitest.test_unicode_name" />
197
+ <item itemvalue="Ruby.scratch_2" />
198
+ <item itemvalue="Ruby.grc" />
196
199
  </list>
197
200
  </recent_temporary>
198
201
  </component>
199
202
  <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
200
203
  <component name="SpringUtil" SPRING_PRE_LOADER_OPTION="true" RAKE_SPRING_PRE_LOADER_OPTION="true" RAILS_SPRING_PRE_LOADER_OPTION="true" />
204
+ <component name="SvnConfiguration">
205
+ <configuration />
206
+ </component>
201
207
  <component name="TaskManager">
202
208
  <task active="true" id="Default" summary="Default task">
203
209
  <changelist id="0af4ebef-9f59-4a85-9f65-0d8163baa737" name="Changes" comment="" />
@@ -208,6 +214,32 @@
208
214
  <workItem from="1657595516239" duration="5292000" />
209
215
  <workItem from="1657776231899" duration="3819000" />
210
216
  <workItem from="1657925313775" duration="11283000" />
217
+ <workItem from="1658162313087" duration="7923000" />
218
+ <workItem from="1658182588862" duration="10908000" />
219
+ <workItem from="1658229649287" duration="2005000" />
220
+ <workItem from="1658243583313" duration="8538000" />
221
+ <workItem from="1658327357205" duration="4811000" />
222
+ <workItem from="1658437305242" duration="60892000" />
223
+ <workItem from="1658793189231" duration="3008000" />
224
+ <workItem from="1659046804362" duration="2017000" />
225
+ <workItem from="1659197586942" duration="1414000" />
226
+ <workItem from="1659204674764" duration="580000" />
227
+ <workItem from="1659298414038" duration="277000" />
228
+ <workItem from="1659298764460" duration="21000" />
229
+ <workItem from="1659298848656" duration="1163000" />
230
+ <workItem from="1659382588913" duration="1766000" />
231
+ <workItem from="1659393975105" duration="7621000" />
232
+ <workItem from="1659884686054" duration="564000" />
233
+ <workItem from="1659914689266" duration="599000" />
234
+ <workItem from="1660407810452" duration="566000" />
235
+ <workItem from="1661147582360" duration="9000" />
236
+ <workItem from="1661570128064" duration="567000" />
237
+ <workItem from="1661730913413" duration="563000" />
238
+ <workItem from="1661793944163" duration="564000" />
239
+ <workItem from="1662035865384" duration="1169000" />
240
+ <workItem from="1662266053254" duration="7000" />
241
+ <workItem from="1662493848057" duration="1197000" />
242
+ <workItem from="1664331878344" duration="2087000" />
211
243
  </task>
212
244
  <task id="LOCAL-00001" summary="Initial commit">
213
245
  <created>1657596693848</created>
@@ -300,7 +332,140 @@
300
332
  <option name="project" value="LOCAL" />
301
333
  <updated>1657953258951</updated>
302
334
  </task>
303
- <option name="localTasksCounter" value="14" />
335
+ <task id="LOCAL-00014" summary="2022-07-16-03-45">
336
+ <created>1657953913633</created>
337
+ <option name="number" value="00014" />
338
+ <option name="presentableId" value="LOCAL-00014" />
339
+ <option name="project" value="LOCAL" />
340
+ <updated>1657953913633</updated>
341
+ </task>
342
+ <task id="LOCAL-00015" summary="2022-07-16-12-41">
343
+ <created>1657986087994</created>
344
+ <option name="number" value="00015" />
345
+ <option name="presentableId" value="LOCAL-00015" />
346
+ <option name="project" value="LOCAL" />
347
+ <updated>1657986087994</updated>
348
+ </task>
349
+ <task id="LOCAL-00016" summary="2022-07-16-12-41">
350
+ <created>1657986472233</created>
351
+ <option name="number" value="00016" />
352
+ <option name="presentableId" value="LOCAL-00016" />
353
+ <option name="project" value="LOCAL" />
354
+ <updated>1657986472233</updated>
355
+ </task>
356
+ <task id="LOCAL-00017" summary="README updated">
357
+ <created>1658025693260</created>
358
+ <option name="number" value="00017" />
359
+ <option name="presentableId" value="LOCAL-00017" />
360
+ <option name="project" value="LOCAL" />
361
+ <updated>1658025693260</updated>
362
+ </task>
363
+ <task id="LOCAL-00018" summary="README updated">
364
+ <created>1658025874297</created>
365
+ <option name="number" value="00018" />
366
+ <option name="presentableId" value="LOCAL-00018" />
367
+ <option name="project" value="LOCAL" />
368
+ <updated>1658025874297</updated>
369
+ </task>
370
+ <task id="LOCAL-00019" summary="README updated">
371
+ <created>1658029175162</created>
372
+ <option name="number" value="00019" />
373
+ <option name="presentableId" value="LOCAL-00019" />
374
+ <option name="project" value="LOCAL" />
375
+ <updated>1658029175162</updated>
376
+ </task>
377
+ <task id="LOCAL-00020" summary="README updated">
378
+ <created>1658030060833</created>
379
+ <option name="number" value="00020" />
380
+ <option name="presentableId" value="LOCAL-00020" />
381
+ <option name="project" value="LOCAL" />
382
+ <updated>1658030060833</updated>
383
+ </task>
384
+ <task id="LOCAL-00021" summary="README updated">
385
+ <created>1658098607476</created>
386
+ <option name="number" value="00021" />
387
+ <option name="presentableId" value="LOCAL-00021" />
388
+ <option name="project" value="LOCAL" />
389
+ <updated>1658098607476</updated>
390
+ </task>
391
+ <task id="LOCAL-00022" summary="Coveralls">
392
+ <created>1658280422988</created>
393
+ <option name="number" value="00022" />
394
+ <option name="presentableId" value="LOCAL-00022" />
395
+ <option name="project" value="LOCAL" />
396
+ <updated>1658280422988</updated>
397
+ </task>
398
+ <task id="LOCAL-00023" summary="Coveralls">
399
+ <created>1658280656062</created>
400
+ <option name="number" value="00023" />
401
+ <option name="presentableId" value="LOCAL-00023" />
402
+ <option name="project" value="LOCAL" />
403
+ <updated>1658280656062</updated>
404
+ </task>
405
+ <task id="LOCAL-00024" summary="Fix last commit">
406
+ <created>1658281489780</created>
407
+ <option name="number" value="00024" />
408
+ <option name="presentableId" value="LOCAL-00024" />
409
+ <option name="project" value="LOCAL" />
410
+ <updated>1658281489780</updated>
411
+ </task>
412
+ <task id="LOCAL-00025" summary="Fix last commit">
413
+ <created>1658282205375</created>
414
+ <option name="number" value="00025" />
415
+ <option name="presentableId" value="LOCAL-00025" />
416
+ <option name="project" value="LOCAL" />
417
+ <updated>1658282205375</updated>
418
+ </task>
419
+ <task id="LOCAL-00026" summary="Fix last commit">
420
+ <created>1658282499690</created>
421
+ <option name="number" value="00026" />
422
+ <option name="presentableId" value="LOCAL-00026" />
423
+ <option name="project" value="LOCAL" />
424
+ <updated>1658282499690</updated>
425
+ </task>
426
+ <task id="LOCAL-00027" summary="Fix last commit">
427
+ <created>1658282721327</created>
428
+ <option name="number" value="00027" />
429
+ <option name="presentableId" value="LOCAL-00027" />
430
+ <option name="project" value="LOCAL" />
431
+ <updated>1658282721327</updated>
432
+ </task>
433
+ <task id="LOCAL-00028" summary="Fix last commit">
434
+ <created>1658282904134</created>
435
+ <option name="number" value="00028" />
436
+ <option name="presentableId" value="LOCAL-00028" />
437
+ <option name="project" value="LOCAL" />
438
+ <updated>1658282904134</updated>
439
+ </task>
440
+ <task id="LOCAL-00029" summary="Fixed readme">
441
+ <created>1658890232799</created>
442
+ <option name="number" value="00029" />
443
+ <option name="presentableId" value="LOCAL-00029" />
444
+ <option name="project" value="LOCAL" />
445
+ <updated>1658890232799</updated>
446
+ </task>
447
+ <task id="LOCAL-00030" summary="codepoints, unicode/data">
448
+ <created>1658890400055</created>
449
+ <option name="number" value="00030" />
450
+ <option name="presentableId" value="LOCAL-00030" />
451
+ <option name="project" value="LOCAL" />
452
+ <updated>1658890400055</updated>
453
+ </task>
454
+ <task id="LOCAL-00031" summary="Fixed readme">
455
+ <created>1658890938880</created>
456
+ <option name="number" value="00031" />
457
+ <option name="presentableId" value="LOCAL-00031" />
458
+ <option name="project" value="LOCAL" />
459
+ <updated>1658890938880</updated>
460
+ </task>
461
+ <task id="LOCAL-00032" summary="Fixed readme">
462
+ <created>1658891037810</created>
463
+ <option name="number" value="00032" />
464
+ <option name="presentableId" value="LOCAL-00032" />
465
+ <option name="project" value="LOCAL" />
466
+ <updated>1658891037810</updated>
467
+ </task>
468
+ <option name="localTasksCounter" value="33" />
304
469
  <servers />
305
470
  </component>
306
471
  <component name="TypeScriptGeneratedFilesManager">
@@ -311,7 +476,24 @@
311
476
  <map>
312
477
  <entry key="MAIN">
313
478
  <value>
314
- <State />
479
+ <State>
480
+ <option name="CUSTOM_BOOLEAN_PROPERTIES">
481
+ <map>
482
+ <entry key="Show.Git.Branches" value="true" />
483
+ </map>
484
+ </option>
485
+ <option name="FILTERS">
486
+ <map>
487
+ <entry key="branch">
488
+ <value>
489
+ <list>
490
+ <option value="Main" />
491
+ </list>
492
+ </value>
493
+ </entry>
494
+ </map>
495
+ </option>
496
+ </State>
315
497
  </value>
316
498
  </entry>
317
499
  </map>
@@ -328,13 +510,20 @@
328
510
  <MESSAGE value="minor fix" />
329
511
  <MESSAGE value="Fixed `oxia_to_tonos` &amp; `tonos_to_oxia` and added the options of `to_tonos` &amp; `to_oxia`. Added `transliterate`." />
330
512
  <MESSAGE value="2022-07-16-03-34" />
331
- <option name="LAST_COMMIT_MESSAGE" value="2022-07-16-03-34" />
513
+ <MESSAGE value="2022-07-16-03-45" />
514
+ <MESSAGE value="2022-07-16-12-41" />
515
+ <MESSAGE value="README updated" />
516
+ <MESSAGE value="Coveralls" />
517
+ <MESSAGE value="Fix last commit" />
518
+ <MESSAGE value="codepoints, unicode/data" />
519
+ <MESSAGE value="Fixed readme" />
520
+ <option name="LAST_COMMIT_MESSAGE" value="Fixed readme" />
332
521
  </component>
333
522
  <component name="com.intellij.coverage.CoverageDataManagerImpl">
334
- <SUITE FILE_PATH="coverage/grc@test_oxia_to_tonos.rcov" NAME="test_oxia_to_tonos Coverage Results" MODIFIED="1657949990401" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="grc" />
523
+ <SUITE FILE_PATH="coverage/grc@test_unicode_name.rcov" NAME="test_unicode_name Coverage Results" MODIFIED="1657596419433" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="grc" />
335
524
  <SUITE FILE_PATH="coverage/grc@test_tonos_to_oxia.rcov" NAME="test_tonos_to_oxia Coverage Results" MODIFIED="1657950558051" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="grc" />
525
+ <SUITE FILE_PATH="coverage/grc@test_oxia_to_tonos.rcov" NAME="test_oxia_to_tonos Coverage Results" MODIFIED="1657949990401" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="grc" />
526
+ <SUITE FILE_PATH="coverage/grc@grc.rcov" NAME="grc Coverage Results" MODIFIED="1658890073797" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="grc" />
336
527
  <SUITE FILE_PATH="coverage/grc@test_grc_rb.rcov" NAME="test_grc.rb Coverage Results" MODIFIED="1657599843372" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="grc" />
337
- <SUITE FILE_PATH="coverage/grc@test_unicode_name.rcov" NAME="test_unicode_name Coverage Results" MODIFIED="1657596419433" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="grc" />
338
- <SUITE FILE_PATH="coverage/grc@grc.rcov" NAME="grc Coverage Results" MODIFIED="1657952337434" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="grc" />
339
528
  </component>
340
529
  </project>
data/.rubocop.yml CHANGED
@@ -19,4 +19,4 @@ Metrics/MethodLength:
19
19
  Enabled: false
20
20
 
21
21
  Metrics/ModuleLength:
22
- Enabled: false
22
+ Enabled: false
data/CHANGELOG.md CHANGED
@@ -3,8 +3,22 @@
3
3
  ## [0.1.0] - 2022-07-12
4
4
 
5
5
  - Initial release
6
-
7
- ## [0.1.3] - 2022-07-12
6
+
7
+ ## [0.1.1] - 2022-07-14
8
+
9
+ - Fixed `no_upcase_diacritics`, `no_downcase_diacritics` and `no_diacritics`.
10
+
11
+ ## [0.1.2] - 2022-07-14
12
+
13
+ - Minor bugfix
14
+ - Updated documentation
15
+
16
+ ## [0.1.3] - 2022-07-16
17
+
8
18
  - Fixed `oxia_to_tonos` & `tonos_to_oxia`
9
19
  - New shorter versions `to_tonos` & `to_oxia`.
10
- - Added `transliterate`.
20
+ - Added `transliterate` (experimental: please report any errors).
21
+
22
+ ## [0.1.4] - 2022-07-16
23
+
24
+ - Added `to_grave` and `to_acute`.
data/Gemfile CHANGED
@@ -17,3 +17,6 @@ gem 'rubocop-minitest', '~> 0.20.1'
17
17
 
18
18
  gem 'rubocop-rake', '~> 0.6.0'
19
19
 
20
+ gem 'unicode-data', '~> 0.1.1'
21
+
22
+ gem 'coveralls', require: false
data/README.md CHANGED
@@ -1,22 +1,10 @@
1
- # GRC - Methods for working with Ancient Greek in Ruby
2
-
3
1
  [![Ruby](https://github.com/bcdavasconcelos/grc/actions/workflows/main.yml/badge.svg)](https://github.com/bcdavasconcelos/grc/actions/workflows/main.yml) [![Gem Version](https://badge.fury.io/rb/grc.svg)](https://badge.fury.io/rb/grc)
4
-
5
- ```ruby
6
- 'αβγ'.grc? # true
7
- 'abc'.grc? # false
8
- 'ἄ'.no_downcase_diacritics # α
9
- 'Ἀ'.no_upcase_diacritics # Α
10
- 'ἄἈ'.no_diacritics # αΑ
11
- 'ά'.tonos_to_oxia # ά
12
- 'ά'.oxia_to_tonos # ά
13
- 'ὰ'.grave_to_acute # ά
14
- 'ά'.acute_to_grave # ὰ
15
- 'α'.unicode_name # ['GREEK SMALL LETTER ALPHA']
16
- 'α'.unicode_points # ['\\u03B1']
17
- 'ᾄ'.nfc # ᾄ
18
- 'ᾄ'.nfd # ᾄ
19
- ```
2
+
3
+ <!--[![Coverage Status](https://coveralls.io/repos/github/bcdavasconcelos/grc/badge.svg?branch=Main)](https://coveralls.io/github/bcdavasconcelos/grc?branch=Main)-->
4
+
5
+ # GRC - Ancient Greek Methods for Ruby
6
+
7
+ Several problems can come up when using unicode greek characters. This gem solves some of them.
20
8
 
21
9
  ## Installation
22
10
 
@@ -30,6 +18,232 @@ If bundler is not being used to manage dependencies, install the gem by executin
30
18
 
31
19
  ## Usage
32
20
 
21
+ ```ruby
22
+ require 'grc'
23
+ ```
24
+
25
+ ## General methods
26
+
27
+ ### `grc?` (str → bool)
28
+
29
+ String contains greek letters? This method will check and return `true` or `false`.
30
+
31
+ ```ruby
32
+ irb(main):001:0> 'Μῆνιν ἄειδε θεὰ Πηληϊάδεω Ἀχιλῆος'.grc?
33
+ => true
34
+
35
+ irb(main):002:0> 'Greekless sentence'.grc?
36
+ => false
37
+ ```
38
+
39
+ ### `tokenize` (str → array)
40
+
41
+ This method will tokenize a string; i.e., return an array of objects such as words and punctuation marks.
42
+
43
+ ```ruby
44
+ irb(main):003:0> 'Πάντες ἄνθρωποι τοῦ εἰδέναι ὀρέγονται φύσει. σημεῖον δ᾽ ἡ τῶν αἰσθήσεων ἀγάπησις· καὶ γὰρ χωρὶς τῆς χρείας ἀγαπῶνται δι᾽ αὑτάς, καὶ μάλιστα τῶν ἄλλων ἡ διὰ τῶν ὀμμάτων.'.tokenize
45
+ => ["Πάντες", "ἄνθρωποι", "τοῦ", "εἰδέναι", "ὀρέγονται", "φύσει", ".", "σημεῖον", "δ᾽", "ἡ",
46
+ "τῶν", "αἰσθήσεων", "ἀγάπησις", "·", "καὶ", "γὰρ", "χωρὶς", "τῆς", "χρείας", "ἀγαπῶνται",
47
+ "δι᾽", "αὑτάς", ",", "καὶ", "μάλιστα", "τῶν", "ἄλλων", "ἡ", "διὰ", "τῶν", "ὀμμάτων", "."]
48
+
49
+ irb(main):004:0> 'Μῆνιν ἄειδε θεὰ Πηληϊάδεω Ἀχιλῆος'.tokenize
50
+ => ["Μῆνιν", "ἄειδε", "θεὰ", "Πηληϊάδεω", "Ἀχιλῆος"]
51
+ ```
52
+
53
+ ### `transliterate` (str → str)
54
+
55
+ This is highly experimental method to transliterate greek into latin letters. Users are likely to encounter bugs and edge-cases. Please, report them.
56
+
57
+ ```ruby
58
+ irb(main):005:0> 'Μῆνιν ἄειδε θεὰ Πηληϊάδεω Ἀχιλῆος'.transliterate
59
+ => "mēnin aeide thea pēlēiadeō achilēos"
60
+
61
+ irb(main):006:0> 'Πάντες ἄνθρωποι τοῦ εἰδέναι ὀρέγονται φύσει'.transliterate
62
+ => "pantes anthrōpoi tou eidenai oregontai physei"
63
+ ```
64
+
65
+ ## Unicode Inspection Methods
66
+
67
+ ### `unicode_points` (str → array)
68
+
69
+ This method will return an array with unicode points (the Unicode mapping) of every character in the string.
70
+
71
+ ```ruby
72
+ irb(main):008:0> 'θεὰ'.unicode_points
73
+ => ["\\u03B8", "\\u03B5", "\\u1F70"]
74
+ ```
75
+
76
+ ### `hash_dump`: (str → hash)
77
+
78
+ Same as `unicode_points`, but returns a hash. Still experimental.
79
+
80
+ ```ruby
81
+ irb(main):009:0> str.hash_dump
82
+ => {"ἄ"=>"\"\\u1F04\"", "ε"=>"\"\\u03B5\"", "ι"=>"\"\\u03B9\"", "δ"=>"\"\\u03B4\""}
83
+ ```
84
+
85
+ ### `unicode_name` (str → array)
86
+
87
+ This method will return an array with the unicode name of each character in the string.
88
+
89
+ ```ruby
90
+ irb(main):010:0> 'θεὰ'.unicode_name
91
+ => ["GREEK SMALL LETTER THETA", "GREEK SMALL LETTER EPSILON", "GREEK SMALL LETTER ALPHA WITH VARIA"]
92
+ ```
93
+
94
+ ## Unicode Normalization
95
+
96
+ Unicode Normalization is exceptionally important for Greek texts. It is used to normalize the text to a standard form, which is used by the computer to compare texts and for performing searches in a database.
97
+
98
+ ### `nfd`: Canonical Decomposition (str → str)
99
+
100
+ This methods will decompose a string into its parts using the canonical decomposition method. This is useful for preparing a string to be used in searches. It will never damage the text by performing irreparable changes: a string can be recomposed using the canonical composition at any time.
101
+
102
+ This is our test string. Pay attention to the first character.
103
+
104
+ ```ruby
105
+ irb(main):011:0> str = 'ἄνθρωπος'
106
+ => "ἄνθρωπος"
107
+ irb(main):012:0> str.unicode_name
108
+ =>
109
+ ["GREEK SMALL LETTER ALPHA WITH PSILI AND OXIA",
110
+ "GREEK SMALL LETTER NU",
111
+ "GREEK SMALL LETTER THETA",
112
+ "GREEK SMALL LETTER RHO",
113
+ "GREEK SMALL LETTER OMEGA",
114
+ "GREEK SMALL LETTER PI",
115
+ "GREEK SMALL LETTER OMICRON",
116
+ "GREEK SMALL LETTER FINAL SIGMA"]
117
+ ```
118
+
119
+ Now, we decomposed the precomposed unicode characters.
120
+
121
+ ```ruby
122
+ irb(main):013:0> str = str.nfd
123
+ => "ἄνθρωπος"
124
+ irb(main):014:0> str.unicode_name
125
+ =>
126
+ ["GREEK SMALL LETTER ALPHA",
127
+ "COMBINING COMMA ABOVE",
128
+ "COMBINING ACUTE ACCENT",
129
+ "GREEK SMALL LETTER NU",
130
+ "GREEK SMALL LETTER THETA",
131
+ "GREEK SMALL LETTER RHO",
132
+ "GREEK SMALL LETTER OMEGA",
133
+ "GREEK SMALL LETTER PI",
134
+ "GREEK SMALL LETTER OMICRON",
135
+ "GREEK SMALL LETTER FINAL SIGMA"]
136
+ ```
137
+
138
+ Notice how `ἄ` (`GREEK SMALL LETTER ALPHA WITH PSILI AND OXIA`) becomes `α` (`GREEK SMALL LETTER ALPHA`), `̓` (`COMBINING COMMA ABOVE`), `́` (`COMBINING ACUTE ACCENT`). If we decompose a string and then try to match a query against it, there will be no need to get the diacritics right and we'll only need the base-character.
139
+
140
+ ### `nfc` (str → str)
141
+
142
+ Using the result string from the last example, we can compose the characters back into its precomposed form. `α` (alpha), `̓` (smooth breathing), `́` (acute accent) will be composed back into a single character, that is, `ἄ` (alpha with breathing and acute accent).
143
+
144
+ ```ruby
145
+ irb(main):015:0> str = str.nfc
146
+ => "ἄνθρωπος"
147
+ irb(main):016:0> str.unicode_name
148
+ =>
149
+ ["GREEK SMALL LETTER ALPHA WITH PSILI AND OXIA",
150
+ "GREEK SMALL LETTER NU",
151
+ "GREEK SMALL LETTER THETA",
152
+ "GREEK SMALL LETTER RHO",
153
+ "GREEK SMALL LETTER OMEGA",
154
+ "GREEK SMALL LETTER PI",
155
+ "GREEK SMALL LETTER OMICRON",
156
+ "GREEK SMALL LETTER FINAL SIGMA"]
157
+ ```
158
+
159
+ ## Diacritical marks
160
+
161
+ This is our example string for the next 3 methods.
162
+
163
+ ```ruby
164
+ irb(main):017:0> str = 'Μῆνιν ἄειδε θεὰ Πηληϊάδεω Ἀχιλῆος'
165
+ => "Μῆνιν ἄειδε θεὰ Πηληϊάδεω Ἀχιλῆος"
166
+ ```
167
+
168
+ ### `no_downcase_diacritics` (str → str)
169
+
170
+ Remove from lowercase characters.
171
+
172
+ ```ruby
173
+ irb(main):018:0> str.no_downcase_diacritics
174
+ => "Μηνιν αειδε θεα Πηληιαδεω Ἀχιληος"
175
+ ```
176
+
177
+ ### `no_upcase_diacritics` (str → str)
178
+
179
+ Remove from uppercase characters.
180
+
181
+ ```ruby
182
+ irb(main):019:0> str.no_upcase_diacritics
183
+ => "Μῆνιν ἄειδε θεὰ Πηληϊάδεω Αχιλῆος"
184
+ ```
185
+
186
+ ### `no_diacritics` (str → str)
187
+
188
+ Remove from all characters.
189
+
190
+ ```ruby
191
+ irb(main):020:0> str.no_diacritics
192
+ => "Μηνιν αειδε θεα Πηληιαδεω Αχιληος"
193
+ ```
194
+
195
+ ## Accents
196
+
197
+ ### `to_grave` (str → str)
198
+
199
+ Change the acute for a grave accent. Alternative name: `tonos_to_grave`
200
+
201
+ ```ruby
202
+ irb(main):021:0> str = str.to_grave
203
+ => "θεὰ"
204
+ ```
205
+
206
+ ### `to_acute` (str → str)
207
+
208
+ Change the grave for an acute accent. Alternative: `grave_to_acute`
209
+
210
+ ```ruby
211
+ irb(main):022:0> str = str.to_acute
212
+ => "θεά"
213
+ ```
214
+
215
+ ### `to_oxia` (str → str)
216
+
217
+ Tonos → Oxia. This should also be self-explanatory, but only if one is aware of the existence of two different types of acute accent for Greek letters in the Unicode system. If you didn't know, now you do.
218
+
219
+ The `tonos` was created when Greece adopted the monotonic system. It was considered a new kind of diacritical mark. Later, this changed and everyone agreed that it is, in fact, no different from the acute accent of polytonic greek.
220
+
221
+ When the Greek Extended Character Set was created specifically for polytonic Greek, however, another character was introduced to represent the acute accent. This character is called `oxia`.
222
+
223
+ The end result? Both characters are visually impossible to distinguish. The `tonos` is now the same as the `oxia` and the standard way to represent the acute accent when it is the only diacritical mark of the base character. Whenever you are typing, if you include other diacritics, it will automatically turn into an `oxia`. But, keep in mind that they have different code points, so one won't match against the other.
224
+
225
+ ```ruby
226
+ irb(main):023:0> str = str.to_oxia
227
+ => "θεά"
228
+
229
+ irb(main):024:0> str.unicode_name
230
+ => ["GREEK SMALL LETTER THETA", "GREEK SMALL LETTER EPSILON", "GREEK SMALL LETTER ALPHA WITH OXIA"]
231
+ ```
232
+
233
+ ### `to_tonos` (str → str)
234
+
235
+ Oxia → Tonos. If in doubt about whether to use `oxia` or `tonos`, the correct answer is `tonos`. So, use this methods to convert an `oxia` to a `tonos`, in all cases where it should be used.
236
+
237
+ ```ruby
238
+ irb(main):025:0> str = str.to_tonos
239
+ => "θεά"
240
+
241
+ irb(main):026:0> str.unicode_name
242
+ => ["GREEK SMALL LETTER THETA", "GREEK SMALL LETTER EPSILON", "GREEK SMALL LETTER ALPHA WITH TONOS"]
243
+ ```
244
+ ## See also
245
+
246
+ - [Unicode in Ruby](https://idiosyncratic-ruby.com/66-ruby-has-character.html)
33
247
 
34
248
  ## Development
35
249
 
@@ -39,7 +253,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
39
253
 
40
254
  ## Contributing
41
255
 
42
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/grc. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/grc/blob/Main/CODE_OF_CONDUCT.md).
256
+ Bug reports and pull requests are welcome on GitHub at https://github.com/bcdav/grc. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md).
43
257
 
44
258
  ## License
45
259
 
@@ -47,4 +261,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
47
261
 
48
262
  ## Code of Conduct
49
263
 
50
- Everyone interacting in the Grc project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/grc/blob/Main/CODE_OF_CONDUCT.md).
264
+ Everyone interacting in the Grc project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md).
data/lib/grc/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Grc
4
- VERSION = '0.1.3'
4
+ VERSION = '0.1.4'
5
5
  end
data/lib/grc.rb CHANGED
@@ -8,252 +8,247 @@ module Grc
8
8
 
9
9
  @std_error = 'ERROR: String does not contain any greek. Summon the muse and try again.'
10
10
 
11
+ # General methods
12
+
13
+ # `grc?` (str → bool)
14
+ # Returns true if the string contains greek characters.
11
15
  def grc?
12
16
  !scan(/(\p{Greek})/).empty?
13
17
  end
14
18
 
15
- def no_downcase_diacritics
16
- return @std_error unless grc?
17
-
18
- tr('ἀἄᾄἂᾂἆᾆᾀἁἅᾅἃᾃἇᾇᾁάάᾴὰᾲᾰᾶᾷᾱᾳἐἔἒἑἕἓέέὲἠἤᾔἢᾒἦᾖᾐἡἥᾕἣᾓἧᾗᾑήήῄὴῂῆῇῃἰἴἲἶἱἵἳἷίίὶῐῖϊϊΐῒῗῑὀὄὂὁὅὃόόὸῤῥὐὔὒὖὑὕὓὗύύὺῠῦϋΰΰΰῢῧῡὠὤᾤὢᾢὦᾦᾠὡὥᾥὣᾣὧᾧᾡώώῴὼῲῶῷῳ',
19
- 'ααααααααααααααααααααααααααεεεεεεεεεηηηηηηηηηηηηηηηηηηηηηηηηιιιιιιιιιιιιιιιιιιιοοοοοοοοορρυυυυυυυυυυυυυυυυυυυυωωωωωωωωωωωωωωωωωωωωωωωω')
19
+ # `tokenize` (str → array)
20
+ # Returns an array of tokens from the string.
21
+ def tokenize
22
+ gsub(/([[:punct:]]|·|·|‧|⸱|𐄁|\.|;|;)/, ' \1').split
20
23
  end
21
24
 
22
- def no_upcase_diacritics
25
+ # `transliterate` (str → str)
26
+ # Returns a string with greek characters replaced with their transliteration.
27
+ def transliterate
23
28
  return @std_error unless grc?
24
29
 
30
+ result = []
25
31
  str = self
26
- # Adhoc solution for odd combinations of diacritics with capital letters
27
- ars = [[/[́̀͂́́́̀͂]/, ''], [/Α͂/, 'Α'], [/Η͂/, 'Η'], [/Ί|Ὶ|Ι͂|́Ι|̀Ι|͂Ι/, 'Ι'],
28
- [/Ρ̓/, 'Ρ'], [/ Ὺ| ́Υ|Υ̓|Ύ|Ὺ|Υ͂|́Υ|̀Υ|͂Υ/, 'Υ'], [/͂Ω/, 'Ω']]
29
- ars.each do |a|
30
- str = str.gsub(/#{a[0]}/, a[1])
32
+ str.tokenize do |token|
33
+ result << if token.grc?
34
+ the_word = token.gsub(/ῥ/, 'rh')
35
+ the_word = the_word =~ /[ἁἅᾅἃᾃἇᾇᾁἑἕἓἡἥᾕἣᾓἧᾗᾑἱἵἳἷὁὅὃὑὕὓὗὡὥᾥὣᾣὧᾧᾡ]/ ? "h#{the_word.no_diacritics}" : the_word.no_diacritics
36
+ hash.each { |k, v| the_word = the_word.gsub(/#{k}/, v) }
37
+ the_word
38
+ else
39
+ word
40
+ end
31
41
  end
32
- str.tr('ἈἌἊἎἉἍἋἏΆᾺᾸᾹἘἜἚἙἝἛΈῈἨἬἪἮἩἭἫἯΉῊἸἼἺἾἹἽἻἿΊῚῘΪῙὈὌὊὉὍὋΌῸΡῬὙὝὛὟΎῪῨΫῩὨὬὪὮὩὭὫὯΏῺ',
33
- 'ΑΑΑΑΑΑΑΑΑΑΑΑΕΕΕΕΕΕΕΕΗΗΗΗΗΗΗΗΗΗΙΙΙΙΙΙΙΙΙΙΙΙΙΟΟΟΟΟΟΟΟΡΡΥΥΥΥΥΥΥΥΥΩΩΩΩΩΩΩΩΩΩ')
42
+ result.join(' ')
34
43
  end
35
44
 
36
- def no_diacritics
37
- return @std_error unless grc?
45
+ # Unicode Inspection Methods
38
46
 
39
- no_downcase_diacritics.no_upcase_diacritics
47
+ # `unicode_points` (str → array)
48
+ # Returns an array of unicode points from the string.
49
+ def unicode_points
50
+ unpack('U*').map { |i| "\\u#{i.to_s(16).rjust(4, "0").upcase}" }
40
51
  end
41
52
 
42
- def tonos_to_oxia
43
- return @std_error unless grc?
53
+ # `hash_dump`: (str → hash)
54
+ # Returns a hash of the string's unicode points (Char: Unicode_points).
55
+ def hash_dump
56
+ hash = {}
57
+ each_char do |character|
58
+ hash[character] = character.dump
59
+ end
60
+ hash
61
+ end
44
62
 
45
- tr('άΆέΈήΉίΊΐόΌύΎΰώΏ',
46
- 'άΆέΈήΉίΊΐόΌύΎΰώΏ')
63
+ # `unicode_name` (str → array)
64
+ # Returns an array of unicode names from the string.
65
+ def unicode_name
66
+ require 'unicode/name'
67
+ each_char.map { |character| Unicode::Name.of character }
47
68
  end
48
69
 
49
- def to_oxia
70
+ # Unicode Normalization
71
+
72
+ # `nfd` (str → str)
73
+ # Returns a string with the canonical decomposition of the string.
74
+ def nfd
75
+ unicode_normalize(:nfd)
76
+ end
77
+
78
+ # `nfc` (str → str)
79
+ # Returns a string with the canonical composition of the string.
80
+ def nfc
81
+ unicode_normalize(:nfc)
82
+ end
83
+
84
+ # Case folding
85
+
86
+ # `grc_downcase` (str → str)
87
+ # Returns the lowercase version of string for greek characters resolving confusable characters.
88
+ # See https://www.w3.org/TR/charmod-norm/#PreNormalization
89
+ def grc_downcase
90
+ nfd.downcase.nfc
91
+ end
92
+
93
+ # `grc_upcase` (str → str)
94
+ # Default `upcase` methods strips diacritical marks from greek characters.
95
+ # This method returns the corresponding uppercase version of string for greek characters preserving diacritical marks.
96
+ # See pages 1-7 of http://www.tlg.uci.edu/encoding/precomposed.pdf
97
+ # https://icu.unicode.org/design/case/greek-upper
98
+ def grc_upcase
99
+ case_map = {
100
+ ᾀ: 'ᾈ',
101
+ ᾁ: 'ᾉ',
102
+ ᾂ: 'ᾊ',
103
+ ᾃ: 'ᾋ',
104
+ ᾄ: 'ᾌ',
105
+ ᾅ: 'ᾍ',
106
+ ᾆ: 'ᾎ',
107
+ ᾇ: 'ᾏ',
108
+ ᾐ: 'ᾘ',
109
+ ᾑ: 'ᾙ',
110
+ ᾒ: 'ᾚ',
111
+ ᾓ: 'ᾛ',
112
+ ᾔ: 'ᾜ',
113
+ ᾕ: 'ᾝ',
114
+ ᾖ: 'ᾞ',
115
+ ᾗ: 'ᾟ',
116
+ ᾠ: 'ᾨ',
117
+ ᾡ: 'ᾩ',
118
+ ᾢ: 'ᾪ',
119
+ ᾣ: 'ᾫ',
120
+ ᾤ: 'ᾬ',
121
+ ᾥ: 'ᾭ',
122
+ ᾦ: 'ᾮ',
123
+ ᾧ: 'ᾯ',
124
+ ᾳ: 'ᾼ',
125
+ ῃ: 'ῌ',
126
+ ῳ: 'ῼ'
127
+ }
128
+
129
+ nfc.each_char.map do |char|
130
+ if char.grc?
131
+ case_map[:"#{char}"] || char.upcase
132
+ else
133
+ char
134
+ end
135
+ end.join
136
+ end
137
+
138
+ # Diacritical marks
139
+
140
+ # `no_downcase_diacritics` (str → str)
141
+ # Returns a string with the diacritics removed from lowercase characters.
142
+ def no_downcase_diacritics
50
143
  return @std_error unless grc?
51
144
 
52
- tonos_to_oxia
145
+ each_char.map do |char| # Loop through each character
146
+ if char.grc? && char.lower? # If character is greek and lowercase
147
+ char.nfd.gsub(/\p{Mn}/, '').nfc # decompose, remove non-spacing markers (diacritics), recompose and return
148
+ else # else
149
+ char # return char
150
+ end
151
+ end.join # end char loop
53
152
  end
54
153
 
55
- def oxia_to_tonos
154
+ # `no_upcase_diacritics` (str → str)
155
+ # Returns a string with the diacritics removed from uppercase characters.
156
+ def no_upcase_diacritics
56
157
  return @std_error unless grc?
57
158
 
58
- tr('άΆέΈήΉίΊΐόΌύΎΰώΏ',
59
- 'άΆέΈήΉίΊΐόΌύΎΰώΏ')
159
+ each_char.map do |char| # Loop through each character
160
+ if char.grc? && char.upper? # If character is greek and uppercase
161
+ char.nfd.gsub(/\p{Mn}/, '').nfc # Decompose, remove non-spacing markers (diacritics), recompose and return
162
+ else # else
163
+ char # Return char
164
+ end
165
+ end.join
60
166
  end
61
167
 
62
- def to_tonos
168
+ # `no_diacritics` (str → str)
169
+ # Returns a string with the diacritics removed.
170
+ def no_diacritics
63
171
  return @std_error unless grc?
64
172
 
65
- oxia_to_tonos
173
+ no_downcase_diacritics.no_upcase_diacritics
66
174
  end
67
175
 
68
- def acute_to_grave
176
+ # Accents
177
+
178
+ # `to_grave` (str → str)
179
+ # Returns a string with the grave replacing the acute accent.
180
+ def to_grave
69
181
  return @std_error unless grc?
70
182
 
183
+ # Simple transform method with grave to acute mapping
71
184
  tr('ἄᾄἅᾅάάᾴἔἕέέἤᾔἥᾕήήῄἴἵίίΐὄὅόόὔὕύύΰΰὤᾤὥᾥώῴ',
72
185
  'ἂᾂἃᾃὰὰᾲἒἓὲὲἢᾒἣᾓὴὴῂἲἳὶὶῒὂὃὸὸὒὓὺὺῢῢὢᾢὣᾣὼῲ')
73
186
  end
74
187
 
75
- def grave_to_acute
188
+ # `to_acute` (str → str)
189
+ # Returns a string with the acute replacing the grave accent.
190
+ def to_acute
76
191
  return @std_error unless grc?
77
192
 
193
+ # Simple transform method with acute to grave mapping
78
194
  tr('ἂᾂἃᾃὰὰᾲἒἓὲὲἢᾒἣᾓὴὴῂἲἳὶὶῒὂὃὸὸὒὓὺὺῢῢὢᾢὣᾣὼῲ',
79
195
  'ἄᾄἅᾅάάᾴἔἕέέἤᾔἥᾕήήῄἴἵίίΐὄὅόόὔὕύύΰΰὤᾤὥᾥώῴ')
80
196
  end
81
197
 
82
- def tokenize
83
- gsub(/([[:punct:]]|·|·|‧|⸱|𐄁|\.|;|;)/, ' \1').split
198
+ # `to_oxia` (str → str)
199
+ # Returns a string with the oxia replacing the tonos.
200
+ def to_oxia
201
+ return @std_error unless grc?
202
+
203
+ tr('άΆέΈήΉίΊΐόΌύΎΰώΏ',
204
+ 'άΆέΈήΉίΊΐόΌύΎΰώΏ')
84
205
  end
85
206
 
86
- def unicode_char
87
- each_char.map(&:to_s)
207
+ # `to_tonos` (str → str)
208
+ # Returns a string with the tonos replacing the oxia.
209
+ # See page 9 of http://www.tlg.uci.edu/encoding/precomposed.pdf
210
+ def to_tonos
211
+ return @std_error unless grc?
212
+
213
+ tr('άΆέΈήΉίΊΐόΌύΎΰώΏ',
214
+ 'άΆέΈήΉίΊΐόΌύΎΰώΏ')
88
215
  end
89
216
 
90
- def unicode_name
91
- require 'unicode/name'
92
- each_char.map { |character| Unicode::Name.of character }
217
+ def upper?
218
+ !!match(/\p{Upper}/)
93
219
  end
94
220
 
95
- def unicode_points
96
- unpack('U*').map { |i| "\\u#{i.to_s(16).rjust(4, "0").upcase}" }
221
+ def lower?
222
+ !!match(/\p{Lower}/)
97
223
  end
98
224
 
99
- def hash_dump
100
- hash = {}
101
- each_char do |character|
102
- hash[character] = character.dump
103
- end
104
- hash
225
+ def oxia_to_tonos
226
+ return @std_error unless grc?
227
+
228
+ to_tonos
105
229
  end
106
230
 
107
- def transliterate
231
+ def tonos_to_oxia
108
232
  return @std_error unless grc?
109
233
 
110
- hash = {
111
- ῥ: 'rh',
112
- ͱ: '',
113
- Ͳ: '',
114
- ͳ: '',
115
- ʹ: '',
116
- "\u0375": '',
117
- Ͷ: '',
118
- ͷ: '',
119
- ͺ: '',
120
- ͻ: '',
121
- ͼ: '',
122
- ͽ: '',
123
- Α: 'a',
124
- Β: 'b',
125
- Γ: 'g',
126
- Δ: 'd',
127
- Ε: 'e',
128
- Ζ: 'z',
129
- Η: 'ē',
130
- Θ: 'th',
131
- Ι: 'i',
132
- Κ: 'k',
133
- Λ: 'l',
134
- Μ: 'm',
135
- Ν: 'n',
136
- Ξ: 'x',
137
- Ο: 'o',
138
- Π: 'p',
139
- Ρ: 'r',
140
- Σ: 's',
141
- Τ: 't',
142
- Υ: 'y',
143
- Φ: 'ph',
144
- Χ: 'ch',
145
- Ψ: 'ps',
146
- Ω: 'ō',
147
- α: 'a',
148
- β: 'b',
149
- γ: 'g',
150
- δ: 'd',
151
- ε: 'e',
152
- ζ: 'z',
153
- η: 'ē',
154
- θ: 'th',
155
- ι: 'i',
156
- κ: 'k',
157
- λ: 'l',
158
- μ: 'm',
159
- ν: 'n',
160
- ξ: 'x',
161
- ο: 'o',
162
- π: 'p',
163
- ρ: 'r',
164
- ς: 's',
165
- σ: 's',
166
- τ: 't',
167
- υ: 'y',
168
- φ: 'ph',
169
- χ: 'ch',
170
- ψ: 'ps',
171
- ω: 'ō',
172
- Ϗ: '',
173
- ϐ: '',
174
- ϑ: '',
175
- ϒ: '',
176
- ϓ: '',
177
- ϔ: '',
178
- ϕ: '',
179
- ϖ: '',
180
- ϗ: '',
181
- Ϙ: '',
182
- ϙ: '',
183
- Ϛ: '',
184
- ϛ: '',
185
- Ϝ: '',
186
- ϝ: '',
187
- Ϟ: '',
188
- ϟ: '',
189
- Ϡ: '',
190
- ϡ: '',
191
- Ϣ: '',
192
- ϣ: '',
193
- Ϥ: '',
194
- ϥ: '',
195
- Ϧ: '',
196
- ϧ: '',
197
- Ϩ: '',
198
- ϩ: '',
199
- Ϫ: '',
200
- ϫ: '',
201
- Ϭ: '',
202
- ϭ: '',
203
- Ϯ: '',
204
- ϯ: '',
205
- ϰ: '',
206
- ϱ: '',
207
- ϲ: '',
208
- ϳ: '',
209
- ϴ: '',
210
- ϵ: '',
211
- "\u03F6": '',
212
- Ϸ: '',
213
- ϸ: '',
214
- Ϲ: '',
215
- Ϻ: '',
216
- ϻ: '',
217
- ϼ: '',
218
- Ͻ: '',
219
- Ͼ: '',
220
- Ͽ: '',
221
- gg: 'ng',
222
- gk: 'nk',
223
- gx: 'nx',
224
- gc: 'nc',
225
- "\u{0314}": 'rh',
226
- rr: 'rrh',
227
- ay: 'au',
228
- ey: 'eu',
229
- ēy: 'ēu',
230
- oy: 'ou',
231
- yi: 'ui'
232
- }
233
- result = []
234
- str = self
235
- str.split.each do |word|
236
- result << if word.grc?
237
- the_word = word.gsub(/ῥ/, 'rh')
238
- the_word = the_word =~ /[ἁἅᾅἃᾃἇᾇᾁἑἕἓἡἥᾕἣᾓἧᾗᾑἱἵἳἷὁὅὃὑὕὓὗὡὥᾥὣᾣὧᾧᾡ]/ ? "h#{the_word.no_diacritics}" : the_word.no_diacritics
239
- hash.each { |k, v| the_word = the_word.gsub(/#{k}/, v) }
240
- the_word
241
- else
242
- word
243
- end
244
- end
245
- result.join(' ')
234
+ to_oxia
246
235
  end
247
236
 
248
- def nfc
249
- unicode_normalize(:nfc)
237
+ def grave_to_acute
238
+ return @std_error unless grc?
239
+
240
+ to_acute
250
241
  end
251
242
 
252
- def nfd
253
- unicode_normalize(:nfd)
243
+ def acute_to_grave
244
+ return @std_error unless grc?
245
+
246
+ to_grave
254
247
  end
248
+
255
249
  end
256
250
 
251
+
257
252
  class String
258
253
  include Grc
259
254
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bernardo C.D.A. Vasconcelos
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-07-16 00:00:00.000000000 Z
11
+ date: 2022-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -67,7 +67,6 @@ files:
67
67
  - CHANGELOG.md
68
68
  - CODE_OF_CONDUCT.md
69
69
  - Gemfile
70
- - Gemfile.lock
71
70
  - LICENSE.txt
72
71
  - README.md
73
72
  - Rakefile
@@ -96,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
95
  - !ruby/object:Gem::Version
97
96
  version: '0'
98
97
  requirements: []
99
- rubygems_version: 3.3.17
98
+ rubygems_version: 3.3.22
100
99
  signing_key:
101
100
  specification_version: 4
102
101
  summary: Methods in Ruby for working with Ancient Greek
data/Gemfile.lock DELETED
@@ -1,58 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- grc (0.1.3)
5
- minitest (~> 5.0)
6
- rake (~> 13.0)
7
- unicode-name (~> 1.10.0)
8
-
9
- GEM
10
- remote: https://rubygems.org/
11
- specs:
12
- ast (2.4.2)
13
- json (2.6.2)
14
- minitest (5.16.2)
15
- parallel (1.22.1)
16
- parser (3.1.2.0)
17
- ast (~> 2.4.1)
18
- rainbow (3.1.1)
19
- rake (13.0.6)
20
- regexp_parser (2.5.0)
21
- rexml (3.2.5)
22
- rubocop (1.31.2)
23
- json (~> 2.3)
24
- parallel (~> 1.10)
25
- parser (>= 3.1.0.0)
26
- rainbow (>= 2.2.2, < 4.0)
27
- regexp_parser (>= 1.8, < 3.0)
28
- rexml (>= 3.2.5, < 4.0)
29
- rubocop-ast (>= 1.18.0, < 2.0)
30
- ruby-progressbar (~> 1.7)
31
- unicode-display_width (>= 1.4.0, < 3.0)
32
- rubocop-ast (1.19.1)
33
- parser (>= 3.1.1.0)
34
- rubocop-minitest (0.20.1)
35
- rubocop (>= 0.90, < 2.0)
36
- rubocop-rake (0.6.0)
37
- rubocop (~> 1.0)
38
- ruby-progressbar (1.11.0)
39
- unicode-display_width (2.2.0)
40
- unicode-name (1.10.0)
41
- unicode-types (~> 1.7)
42
- unicode-types (1.7.0)
43
-
44
- PLATFORMS
45
- arm64-darwin-21
46
- x86_64-linux
47
-
48
- DEPENDENCIES
49
- grc!
50
- minitest (~> 5.0)
51
- rake (~> 13.0)
52
- rubocop (~> 1.21)
53
- rubocop-minitest (~> 0.20.1)
54
- rubocop-rake (~> 0.6.0)
55
- unicode-name (~> 1.10.0)
56
-
57
- BUNDLED WITH
58
- 2.3.17