furigana_ruby 1.0.0 → 1.0.1
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/furigana_ruby-1.0.0.gem +0 -0
- data/lib/furigana_ruby/parser.rb +4 -9
- data/lib/furigana_ruby/utils.rb +16 -0
- data/lib/furigana_ruby/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94f70019413d7ce68b896c5d0e3ec459d8544a1383d7d899f494b60216738108
|
4
|
+
data.tar.gz: 71e841b6f7a90a826d1f338e86f651c2e0a42af1e24113fad97bfe1b8a5f9904
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f4df3f76fa36247e7414173f2a3fde663f6a96d2704b4387969d6103ed4698d5b1fde2e6b70c8be0dc348f5cb05c2d21bee3d9d0d1e9fc2db930f066b0ef93b
|
7
|
+
data.tar.gz: 28b9526ed2b6d3a48119f209af54b570e8c0fd9830fb327cd1871063a0edc16df41932c5ae27471474a591af6a59a234b7d8cbba88e4ac27edbbcb970742a55f
|
Binary file
|
data/lib/furigana_ruby/parser.rb
CHANGED
@@ -1,11 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
# @param [String] string
|
5
|
-
# @return [Boolean]
|
6
|
-
def present?(string)
|
7
|
-
!string.nil? && !string.empty? && string.strip.length.positive?
|
8
|
-
end
|
3
|
+
require_relative "utils"
|
9
4
|
|
10
5
|
module FuriganaRuby
|
11
6
|
##
|
@@ -45,7 +40,7 @@ module FuriganaRuby
|
|
45
40
|
@current_base = ""
|
46
41
|
@current_furigana = ""
|
47
42
|
@parsing_base_section = true
|
48
|
-
@characters = present?(reading) && reading.length ? reading.split("") : []
|
43
|
+
@characters = Utils.present?(reading) && reading.length ? reading.split("") : []
|
49
44
|
|
50
45
|
process
|
51
46
|
end
|
@@ -85,7 +80,7 @@ module FuriganaRuby
|
|
85
80
|
# @param [String] base_text
|
86
81
|
# @param [String] furigana
|
87
82
|
def get_segment(base_text, furigana)
|
88
|
-
return UndecoratedSegment.new(base_text) unless present?(furigana)
|
83
|
+
return UndecoratedSegment.new(base_text) unless Utils.present?(furigana)
|
89
84
|
|
90
85
|
FuriganaSegment.new(base_text, furigana)
|
91
86
|
end
|
@@ -106,7 +101,7 @@ module FuriganaRuby
|
|
106
101
|
# @return [Boolean]
|
107
102
|
def kanji?(character)
|
108
103
|
char = character[0, 1]
|
109
|
-
present?(character) && char.ord >= 0x4e00 && char.ord <= 0x9faf
|
104
|
+
Utils.present?(character) && char.ord >= 0x4e00 && char.ord <= 0x9faf
|
110
105
|
end
|
111
106
|
end
|
112
107
|
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module FuriganaRuby
|
4
|
+
##
|
5
|
+
# Util methods
|
6
|
+
class Utils
|
7
|
+
class << self
|
8
|
+
##
|
9
|
+
# @param [String] string
|
10
|
+
# @return [Boolean]
|
11
|
+
def present?(string)
|
12
|
+
!string.nil? && !string.empty? && string.strip.length.positive?
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: furigana_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Ellingson
|
@@ -27,8 +27,10 @@ files:
|
|
27
27
|
- Rakefile
|
28
28
|
- bin/console
|
29
29
|
- bin/setup
|
30
|
+
- furigana_ruby-1.0.0.gem
|
30
31
|
- lib/furigana_ruby.rb
|
31
32
|
- lib/furigana_ruby/parser.rb
|
33
|
+
- lib/furigana_ruby/utils.rb
|
32
34
|
- lib/furigana_ruby/version.rb
|
33
35
|
homepage: https://github.com/e-e/furigana-ruby
|
34
36
|
licenses:
|