jisx0208 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bump_new_version.sh +1 -1
- data/lib/jisx0208/processor.rb +12 -0
- data/lib/jisx0208/version.rb +1 -1
- data/lib/jisx0208.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df31e4cd2133bcd6d29df8dc276a6d91416830a584562e481ec7bf467317a3da
|
4
|
+
data.tar.gz: 403efbc30320410819b124682aa52cf74af5c39c5e8c9558514d9666b5ef0160
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34088717a5e2e284b703d50d3846e9fd0c3e4e9e94067c508a9b713eddd560bee6105c9346682174f6c8e27a6360b6a027ffbb9ca0d7e212b9b7a5d582a19cb5
|
7
|
+
data.tar.gz: 567da61871adffd160b74310a96da30ea3536f61beddeea494ec1370fda8d2cd5d6aba44cb02ccb04cfd0a2d67139e4a56dc9d7036c4caa0a5aec3136f81d719
|
data/bump_new_version.sh
CHANGED
@@ -21,11 +21,11 @@ echo "Start bumping version: $VERSION"
|
|
21
21
|
git checkout master
|
22
22
|
git checkout -b release/$VERSION
|
23
23
|
sed -i '' "s/VERSION = \".*\"/VERSION = \"$VERSION\"/" lib/$PROJECT_NAME/version.rb
|
24
|
-
git commit -am "Bump version $VERSION"
|
25
24
|
|
26
25
|
# Publish to rubygems
|
27
26
|
gem build $PROJECT_NAME.gemspec
|
28
27
|
bundle install
|
28
|
+
git commit -am "Bump version $VERSION"
|
29
29
|
gem push $PROJECT_NAME-$VERSION.gem
|
30
30
|
|
31
31
|
# GitHub release
|
data/lib/jisx0208/processor.rb
CHANGED
@@ -17,6 +17,7 @@ module JISX0208
|
|
17
17
|
# see http://ash.jp/code/unitbl21.htm
|
18
18
|
@first_level_ranges = collect_unicode_set(mappings, 0x3021, 0x4F53)
|
19
19
|
@second_level_ranges = collect_unicode_set(mappings, 0x5021, 0x7426)
|
20
|
+
@others_ranges = collect_unicode_set(mappings, 0x2120, 0x2840)
|
20
21
|
end
|
21
22
|
|
22
23
|
def contains_first_level_kanji?(string)
|
@@ -31,6 +32,12 @@ module JISX0208
|
|
31
32
|
contains_first_level_kanji?(string) || contains_seconde_level_kanji?(string)
|
32
33
|
end
|
33
34
|
|
35
|
+
def contains_jisx0208?(string)
|
36
|
+
contains_jisx0208_kanji?(string) || string.each_char.any? do |char|
|
37
|
+
@others_ranges.include?(char.ord)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
34
41
|
def only_first_level_kanji?(string)
|
35
42
|
string.each_char.all? { |char| @first_level_ranges.include?(char.ord) }
|
36
43
|
end
|
@@ -44,6 +51,11 @@ module JISX0208
|
|
44
51
|
string.each_char.all? { |char| jisx0208.include?(char.ord) }
|
45
52
|
end
|
46
53
|
|
54
|
+
def only_jisx0208?(string)
|
55
|
+
jisx0208 = @first_level_ranges + @second_level_ranges + @others_ranges
|
56
|
+
string.each_char.all? { |char| jisx0208.include?(char.ord) }
|
57
|
+
end
|
58
|
+
|
47
59
|
private
|
48
60
|
|
49
61
|
def collect_unicode_set(mappings, jisx_start, jisx_end)
|
data/lib/jisx0208/version.rb
CHANGED
data/lib/jisx0208.rb
CHANGED
@@ -32,5 +32,13 @@ module JISX0208
|
|
32
32
|
def only_jisx0208_kanji?(string)
|
33
33
|
@processor.only_jisx0208_kanji?(string)
|
34
34
|
end
|
35
|
+
|
36
|
+
def contains_jisx0208?(string)
|
37
|
+
@processor.contains_jisx0208?(string)
|
38
|
+
end
|
39
|
+
|
40
|
+
def only_jisx0208?(string)
|
41
|
+
@processor.only_jisx0208?(string)
|
42
|
+
end
|
35
43
|
end
|
36
44
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jisx0208
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kaiba
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-11-
|
11
|
+
date: 2024-11-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Determines if a character is included in jisx0208 with JIS0208.TXT
|
14
14
|
email:
|