jisx0208 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -0
- data/bump_new_version.sh +38 -0
- data/lib/jisx0208/processor.rb +13 -0
- data/lib/jisx0208/version.rb +1 -1
- data/lib/jisx0208.rb +12 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4882fd21cc240c35aa206dae9dd52f9e9078345516a60a7647118b97643d04bd
|
4
|
+
data.tar.gz: 71c76bb9d4d02443ba45e1725665a6c8c024a0603fe2e36d4bbe4a38f69f3d5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28c4747318ecd804242ac8b7558b6302a5278a248dd0edd11b9628c15ccf1a42a8408950a26c369bd1e5309c81bcf6948d3432e0f6118d0c6e76e32d37e99734
|
7
|
+
data.tar.gz: 669d0d3e8edc8e2817d8f38d670fdad09e60f0b77bb6e19a862dd8dbb54c995bf6762d1e1a013493752179b2a5570bc075a911a19a26d9c7b1e676a7393b82d9
|
data/README.md
CHANGED
@@ -21,4 +21,9 @@ code.contains_seconde_level_kanji?("弌") # => true
|
|
21
21
|
code.contains_seconde_level_kanji?("亜") # => false
|
22
22
|
# same as (contains_first_level_kanji || contains_seconde_level_kanji)
|
23
23
|
code.contains_jisx0208_kanji?("亜弌") # => true
|
24
|
+
|
25
|
+
code.only_first_level_kanji?("回転寿司") # => true
|
26
|
+
code.only_second_level_kanji?("偃龠偕") # => true
|
27
|
+
# same as (only_first_level_kanji || only_second_level_kanji)
|
28
|
+
code.only_jisx0208_kanji?("回転寿司偃龠偕") # => true
|
24
29
|
```
|
data/bump_new_version.sh
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
if [ -z "$1" ]; then
|
4
|
+
echo "Usage: $0 <version>"
|
5
|
+
exit 1
|
6
|
+
fi
|
7
|
+
|
8
|
+
# ~/.gem/credentials
|
9
|
+
if [ ! -f ~/.gem/credentials ]; then
|
10
|
+
echo "Error: ~/.gem/credentials not found. Please set up your RubyGems credentials."
|
11
|
+
exit 1
|
12
|
+
fi
|
13
|
+
|
14
|
+
PROJECT_NAME="jisx0208"
|
15
|
+
GITHUB_REPO="kaibadash/jisx0208-ruby"
|
16
|
+
VERSION=$1
|
17
|
+
echo "Start bumping version: $VERSION"
|
18
|
+
|
19
|
+
# Publish
|
20
|
+
# Add release branch
|
21
|
+
git checkout master
|
22
|
+
git checkout -b release/$VERSION
|
23
|
+
sed -i '' "s/VERSION = \".*\"/VERSION = \"$VERSION\"/" lib/$PROJECT_NAME/version.rb
|
24
|
+
git commit -am "Bump version $VERSION"
|
25
|
+
|
26
|
+
# Publish to rubygems
|
27
|
+
gem build $PROJECT_NAME.gemspec
|
28
|
+
bundle install
|
29
|
+
gem push $PROJECT_NAME-$VERSION.gem
|
30
|
+
|
31
|
+
# GitHub release
|
32
|
+
git tag $VERSION
|
33
|
+
git push --tags
|
34
|
+
open https://github.com/$GITHUB_REPO/releases/new
|
35
|
+
|
36
|
+
# merge to master
|
37
|
+
git checkout master
|
38
|
+
git merge release/$VERSION
|
data/lib/jisx0208/processor.rb
CHANGED
@@ -31,6 +31,19 @@ module JISX0208
|
|
31
31
|
contains_first_level_kanji?(string) || contains_seconde_level_kanji?(string)
|
32
32
|
end
|
33
33
|
|
34
|
+
def only_first_level_kanji?(string)
|
35
|
+
string.each_char.all? { |char| @first_level_ranges.include?(char.ord) }
|
36
|
+
end
|
37
|
+
|
38
|
+
def only_second_level_kanji?(string)
|
39
|
+
string.each_char.all? { |char| @second_level_ranges.include?(char.ord) }
|
40
|
+
end
|
41
|
+
|
42
|
+
def only_jisx0208_kanji?(string)
|
43
|
+
jisx0208 = @first_level_ranges + @second_level_ranges
|
44
|
+
string.each_char.all? { |char| jisx0208.include?(char.ord) }
|
45
|
+
end
|
46
|
+
|
34
47
|
private
|
35
48
|
|
36
49
|
def collect_unicode_set(mappings, jisx_start, jisx_end)
|
data/lib/jisx0208/version.rb
CHANGED
data/lib/jisx0208.rb
CHANGED
@@ -20,5 +20,17 @@ module JISX0208
|
|
20
20
|
def contains_jisx0208_kanji?(string)
|
21
21
|
@processor.contains_jisx0208_kanji?(string)
|
22
22
|
end
|
23
|
+
|
24
|
+
def only_first_level_kanji?(string)
|
25
|
+
@processor.only_first_level_kanji?(string)
|
26
|
+
end
|
27
|
+
|
28
|
+
def only_second_level_kanji?(string)
|
29
|
+
@processor.only_second_level_kanji?(string)
|
30
|
+
end
|
31
|
+
|
32
|
+
def only_jisx0208_kanji?(string)
|
33
|
+
@processor.only_jisx0208_kanji?(string)
|
34
|
+
end
|
23
35
|
end
|
24
36
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jisx0208
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kaiba
|
@@ -21,6 +21,7 @@ files:
|
|
21
21
|
- LICENSE
|
22
22
|
- README.md
|
23
23
|
- Rakefile
|
24
|
+
- bump_new_version.sh
|
24
25
|
- data/JIS0208.TXT
|
25
26
|
- lib/jisx0208.rb
|
26
27
|
- lib/jisx0208/processor.rb
|