al_bhed 0.1.2 → 0.1.3
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/ruby.yml +32 -0
- data/.rubocop.yml +5 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile +1 -0
- data/README.md +1 -0
- data/lib/al_bhed.rb +75 -79
- data/lib/al_bhed/version.rb +3 -1
- metadata +4 -3
- data/.travis.yml +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc05c3d88e54272c6049301bd8e60f02248e8becfb71772c641eec37ffcbd87b
|
4
|
+
data.tar.gz: e9bf5912ed5ac14521ea3fe955d9c78760f4a148c4f588690292fb7167060a3b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71ae206b57bbb3cead5b4e6439b82d4051a062b94648bbe868b505c2f409eae309982e05347b2200b888b1c3a732b04436a11f5f61c1925defadc81cd0ef8791
|
7
|
+
data.tar.gz: e3e0a25b88e93ea602c43e358b3bfa256006f99bfb4713aeeaf56ebdb39bd0b04e94568734f05bc8fa4052a2ee342511e914a6acec293d876962609e43b152e3
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
2
|
+
# They are provided by a third-party and are governed by
|
3
|
+
# separate terms of service, privacy policy, and support
|
4
|
+
# documentation.
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
+
|
8
|
+
name: Ruby
|
9
|
+
|
10
|
+
on:
|
11
|
+
push:
|
12
|
+
branches: [ master ]
|
13
|
+
pull_request:
|
14
|
+
branches: [ master ]
|
15
|
+
|
16
|
+
jobs:
|
17
|
+
test:
|
18
|
+
|
19
|
+
runs-on: ubuntu-latest
|
20
|
+
|
21
|
+
steps:
|
22
|
+
- uses: actions/checkout@v2
|
23
|
+
- name: Set up Ruby
|
24
|
+
uses: ruby/setup-ruby@v1
|
25
|
+
with:
|
26
|
+
ruby-version: 2.7
|
27
|
+
- name: Install dependencies
|
28
|
+
run: bundle install
|
29
|
+
- name: Run Rubocop
|
30
|
+
run: bundle exec rubocop lib
|
31
|
+
- name: Run tests
|
32
|
+
run: bundle exec rake spec
|
data/.rubocop.yml
ADDED
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
data/lib/al_bhed.rb
CHANGED
@@ -1,101 +1,97 @@
|
|
1
|
+
# frozen_string_literal: false
|
2
|
+
|
1
3
|
require "al_bhed/version"
|
2
4
|
|
5
|
+
# This is a namespace so as to open up for a built-in String class
|
3
6
|
module AlBhed
|
4
7
|
class Error < StandardError; end
|
5
8
|
|
6
|
-
UPCASES = %w
|
7
|
-
UPCASED_ALBHEDS = %w
|
8
|
-
DOWNCASES = %w
|
9
|
-
DOWNCASED_ALBHEDS = %w
|
9
|
+
UPCASES = %w[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z].freeze
|
10
|
+
UPCASED_ALBHEDS = %w[Y P L T A V K R E Z G M S H U B X N C D I J F Q O W].freeze
|
11
|
+
DOWNCASES = %w[a b c d e f g h i j k l m n o p q r s t u v w x y z].freeze
|
12
|
+
DOWNCASED_ALBHEDS = %w[y p l t a v k r e z g m s h u b x n c d i j f q o w].freeze
|
10
13
|
|
11
|
-
HIRA_KANA = %w
|
12
|
-
KATA_KANA = %w
|
13
|
-
HIRA_DAKUON = %w
|
14
|
-
KATA_DAKUON = %w
|
15
|
-
KANA_ALBHEDS = %w
|
16
|
-
DAKUON_ALBHEDS = %w
|
14
|
+
HIRA_KANA = %w[あ い う え お か き く け こ さ し す せ そ た ち つ て と な に ぬ ね の は ひ ふ へ ほ ま み む め も や ゆ よ ら り る れ ろ わ を ん].freeze
|
15
|
+
KATA_KANA = %w[ア イ ウ エ オ カ キ ク ケ コ サ シ ス セ ソ タ チ ツ テ ト ナ ニ ヌ ネ ノ ハ ヒ フ ヘ ホ マ ミ ム メ モ ヤ ユ ヨ ラ リ ル レ ロ ワ ヲ ン].freeze
|
16
|
+
HIRA_DAKUON = %w[が ぎ ぐ げ ご ざ じ ず ぜ ぞ だ ぢ づ で ど ば び ぶ べ ぼ ぱ ぴ ぷ ぺ ぽ].freeze
|
17
|
+
KATA_DAKUON = %w[ガ ギ グ ゲ ゴ ザ ジ ズ ゼ ゾ ダ ヂ ヅ デ ド バ ビ ブ ベ ボ パ ピ プ ペ ポ].freeze
|
18
|
+
KANA_ALBHEDS = %w[ワ ミ フ ネ ト ア チ ル テ ヨ ラ キ ヌ ヘ ホ サ ヒ ユ セ ソ ハ シ ス メ オ マ リ ク ケ ロ ヤ イ ツ レ コ タ ヲ モ ナ ニ ウ エ ノ カ ム ン].freeze
|
19
|
+
DAKUON_ALBHEDS = %w[ダ ジ ヅ デ ゾ バ ギ ブ ゲ ボ ガ ビ グ ベ ゴ ザ ヂ ズ ゼ ド プ ペ パ ポ ピ].freeze
|
20
|
+
end
|
17
21
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
else
|
32
|
-
results << from_japanese_to_albhed(c)
|
33
|
-
end
|
34
|
-
end
|
22
|
+
# a built-in String class
|
23
|
+
class String
|
24
|
+
# Translate into Al Bhed
|
25
|
+
#
|
26
|
+
# Example:
|
27
|
+
# >> "Hi!".to_albhed
|
28
|
+
# => "Re!"
|
29
|
+
#
|
30
|
+
# Arguments:
|
31
|
+
# nothing
|
32
|
+
def to_albhed
|
33
|
+
chars.inject("") do |results, c|
|
34
|
+
results << (latin?(c) ? from_english_to_albhed(c) : from_japanese_to_albhed(c))
|
35
35
|
end
|
36
|
+
end
|
36
37
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
results << from_albhed_to_english(c)
|
49
|
-
else
|
50
|
-
results << from_albhed_to_japanese(c, hira: hira)
|
51
|
-
end
|
52
|
-
end
|
38
|
+
# Translate Al Bhed into English
|
39
|
+
#
|
40
|
+
# Example:
|
41
|
+
# >> "Re!".from_albhed
|
42
|
+
# => "Hi!"
|
43
|
+
#
|
44
|
+
# Arguments:
|
45
|
+
# hira: (Boolean)
|
46
|
+
def from_albhed(hira: false)
|
47
|
+
chars.inject("") do |results, c|
|
48
|
+
results << (latin?(c) ? from_albhed_to_english(c) : from_albhed_to_japanese(c, hira: hira))
|
53
49
|
end
|
50
|
+
end
|
54
51
|
|
55
|
-
|
52
|
+
private
|
56
53
|
|
57
|
-
|
58
|
-
|
59
|
-
|
54
|
+
def latin?(char)
|
55
|
+
("a".."z").include?(char) || ("A".."Z").include?(char)
|
56
|
+
end
|
60
57
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
end
|
58
|
+
def from_english_to_albhed(char)
|
59
|
+
if (idx = AlBhed::DOWNCASES.index(char))
|
60
|
+
AlBhed::DOWNCASED_ALBHEDS[idx]
|
61
|
+
elsif (idx = AlBhed::UPCASES.index(char))
|
62
|
+
AlBhed::UPCASED_ALBHEDS[idx]
|
63
|
+
else
|
64
|
+
char
|
69
65
|
end
|
66
|
+
end
|
70
67
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
end
|
68
|
+
def from_albhed_to_english(char)
|
69
|
+
if (idx = AlBhed::DOWNCASED_ALBHEDS.index(char))
|
70
|
+
AlBhed::DOWNCASES[idx]
|
71
|
+
elsif (idx = AlBhed::UPCASED_ALBHEDS.index(char))
|
72
|
+
AlBhed::UPCASES[idx]
|
73
|
+
else
|
74
|
+
char
|
79
75
|
end
|
76
|
+
end
|
80
77
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
end
|
78
|
+
def from_japanese_to_albhed(char)
|
79
|
+
if (idx = AlBhed::HIRA_KANA.index(char) || AlBhed::KATA_KANA.index(char))
|
80
|
+
AlBhed::KANA_ALBHEDS[idx]
|
81
|
+
elsif (idx = AlBhed::HIRA_DAKUON.index(char) || AlBhed::KATA_DAKUON.index(char))
|
82
|
+
AlBhed::DAKUON_ALBHEDS[idx]
|
83
|
+
else
|
84
|
+
char
|
89
85
|
end
|
86
|
+
end
|
90
87
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
end
|
88
|
+
def from_albhed_to_japanese(char, hira: false)
|
89
|
+
if (idx = AlBhed::KANA_ALBHEDS.index(char))
|
90
|
+
hira ? AlBhed::HIRA_KANA[idx] : AlBhed::KATA_KANA[idx]
|
91
|
+
elsif (idx = AlBhed::DAKUON_ALBHEDS.index(char))
|
92
|
+
hira ? AlBhed::HIRA_DAKUON[idx] : AlBhed::KATA_DAKUON[idx]
|
93
|
+
else
|
94
|
+
char
|
99
95
|
end
|
100
96
|
end
|
101
97
|
end
|
data/lib/al_bhed/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: al_bhed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- HrsUed
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Translator for Al Bhed language in FINAL FANTASY X
|
14
14
|
email:
|
@@ -17,9 +17,10 @@ executables: []
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
+
- ".github/workflows/ruby.yml"
|
20
21
|
- ".gitignore"
|
21
22
|
- ".rspec"
|
22
|
-
- ".
|
23
|
+
- ".rubocop.yml"
|
23
24
|
- CHANGELOG.md
|
24
25
|
- CODE_OF_CONDUCT.md
|
25
26
|
- Gemfile
|