jisx0208 0.2.0 → 0.4.0

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: 4882fd21cc240c35aa206dae9dd52f9e9078345516a60a7647118b97643d04bd
4
- data.tar.gz: 71c76bb9d4d02443ba45e1725665a6c8c024a0603fe2e36d4bbe4a38f69f3d5c
3
+ metadata.gz: 81169ebbbff0fd9c19b339eda72d3b6b56a2cb7b2924e78e7692592e09b5d431
4
+ data.tar.gz: 987e03026f974ce7ed2a880ab88eee6bfd528b43d69dfa3672af29569c1d1fcd
5
5
  SHA512:
6
- metadata.gz: 28c4747318ecd804242ac8b7558b6302a5278a248dd0edd11b9628c15ccf1a42a8408950a26c369bd1e5309c81bcf6948d3432e0f6118d0c6e76e32d37e99734
7
- data.tar.gz: 669d0d3e8edc8e2817d8f38d670fdad09e60f0b77bb6e19a862dd8dbb54c995bf6762d1e1a013493752179b2a5570bc075a911a19a26d9c7b1e676a7393b82d9
6
+ metadata.gz: f2a4199696e16c9c95e21d80d213c971c2dc726d6cd0930bd9b50c608238fccbbed3ca14b33413329e4b8b715f9314429516c4453fe4c1315cd056e767557a69
7
+ data.tar.gz: 7b7846ccab60688360110c4ae3cb4afd9ffd0aefbbc1ec93f8c8b6328a05ffc1bfafb25b446f421e4bb8cc14694110aca0ce0a9e9539cca6c56891052a0850ed
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
@@ -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,17 @@ 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
+
59
+ # hiragana, katakana, multi byte symbols, first level kanji
60
+ def only_common_japanese_characters?(string)
61
+ common = @others_ranges + @first_level_ranges
62
+ string.each_char.all? { |char| common.include?(char.ord) }
63
+ end
64
+
47
65
  private
48
66
 
49
67
  def collect_unicode_set(mappings, jisx_start, jisx_end)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Jisx0208
4
- VERSION = "0.2.0"
4
+ VERSION = "0.4.0"
5
5
  end
data/lib/jisx0208.rb CHANGED
@@ -32,5 +32,17 @@ 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
43
+
44
+ def only_common_japanese_characters?(string)
45
+ @processor.only_common_japanese_characters?(string)
46
+ end
35
47
  end
36
48
  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.2.0
4
+ version: 0.4.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-19 00:00:00.000000000 Z
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: