mojiru 0.1.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/mojiru/version.rb +1 -1
- data/lib/mojiru.rb +30 -2
- data/mojiru.gemspec +4 -3
- metadata +32 -20
- data/lib/mojiru/string.rb +0 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a16e1836606e71e84b25e74fac894e38ee11a02de80cd18882d8a604ff779e44
|
4
|
+
data.tar.gz: da65e239b865a5d39020f89ba22588c8e26d4b68c529311fbd2015b9d6244654
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b05cb57596e2f08130de35a99cdb4fc620315e507a9a87275f333f6676568b9d61987d863626a37453168bac40cd6d91fb6a427541c0ffdd19ab4f270eeb4ab
|
7
|
+
data.tar.gz: d1dc4a292fdad190c9f119c576078111f04412f180aef21abad74c479ce0c3602e65a790cabaeb05d7af74e80f9d891931e330fcce86b56568ddae27e6ec9734
|
data/lib/mojiru/version.rb
CHANGED
data/lib/mojiru.rb
CHANGED
@@ -1,8 +1,36 @@
|
|
1
1
|
require 'mojiru/version'
|
2
|
-
require '
|
2
|
+
require 'nkf'
|
3
3
|
|
4
4
|
module Mojiru
|
5
|
+
UTF8_BOM = "\xEF\xBB\xBF"
|
6
|
+
|
5
7
|
refine ::String do
|
6
|
-
|
8
|
+
def zen_to_han
|
9
|
+
NKF.nkf('-x -Z4 -W -w', self)
|
10
|
+
end
|
11
|
+
|
12
|
+
def han_to_zen
|
13
|
+
NKF.nkf('-W -w', self).tr('0-9a-zA-Z', '0-9a-zA-Z')
|
14
|
+
end
|
15
|
+
|
16
|
+
def hiragana
|
17
|
+
NKF.nkf('--hiragana -W -w', self)
|
18
|
+
end
|
19
|
+
|
20
|
+
def katakana
|
21
|
+
NKF.nkf('--katakana -W -w', self)
|
22
|
+
end
|
23
|
+
|
24
|
+
def normalize_zen_han
|
25
|
+
NKF.nkf('-m0Z1 -W -w', self)
|
26
|
+
end
|
27
|
+
|
28
|
+
def strip_blank
|
29
|
+
gsub(/\A[[:blank:]]+|[[:blank:]]+\Z/, '')
|
30
|
+
end
|
31
|
+
|
32
|
+
def prepend_utf8_bom
|
33
|
+
UTF8_BOM + self
|
34
|
+
end
|
7
35
|
end
|
8
36
|
end
|
data/mojiru.gemspec
CHANGED
@@ -20,7 +20,8 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
21
|
spec.require_paths = ["lib"]
|
22
22
|
|
23
|
-
spec.
|
24
|
-
spec.add_development_dependency "
|
25
|
-
spec.add_development_dependency "
|
23
|
+
spec.add_dependency "nkf"
|
24
|
+
spec.add_development_dependency "bundler"
|
25
|
+
spec.add_development_dependency "rake"
|
26
|
+
spec.add_development_dependency "rspec"
|
26
27
|
end
|
metadata
CHANGED
@@ -1,57 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mojiru
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- aki77
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: nkf
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: bundler
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
16
30
|
requirements:
|
17
|
-
- - "
|
31
|
+
- - ">="
|
18
32
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
33
|
+
version: '0'
|
20
34
|
type: :development
|
21
35
|
prerelease: false
|
22
36
|
version_requirements: !ruby/object:Gem::Requirement
|
23
37
|
requirements:
|
24
|
-
- - "
|
38
|
+
- - ">="
|
25
39
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rake
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
|
-
- - "
|
45
|
+
- - ">="
|
32
46
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
47
|
+
version: '0'
|
34
48
|
type: :development
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
|
-
- - "
|
52
|
+
- - ">="
|
39
53
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rspec
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
|
-
- - "
|
59
|
+
- - ">="
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
61
|
+
version: '0'
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
|
-
- - "
|
66
|
+
- - ">="
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
68
|
+
version: '0'
|
55
69
|
description: Provides japanese conversion functionality for Strings using Ruby Refinements.
|
56
70
|
email:
|
57
71
|
- aki77@users.noreply.github.com
|
@@ -70,14 +84,13 @@ files:
|
|
70
84
|
- bin/console
|
71
85
|
- bin/setup
|
72
86
|
- lib/mojiru.rb
|
73
|
-
- lib/mojiru/string.rb
|
74
87
|
- lib/mojiru/version.rb
|
75
88
|
- mojiru.gemspec
|
76
89
|
homepage: https://github.com/aki77/mojiru
|
77
90
|
licenses:
|
78
91
|
- MIT
|
79
92
|
metadata: {}
|
80
|
-
post_install_message:
|
93
|
+
post_install_message:
|
81
94
|
rdoc_options: []
|
82
95
|
require_paths:
|
83
96
|
- lib
|
@@ -92,9 +105,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
105
|
- !ruby/object:Gem::Version
|
93
106
|
version: '0'
|
94
107
|
requirements: []
|
95
|
-
|
96
|
-
|
97
|
-
signing_key:
|
108
|
+
rubygems_version: 3.4.10
|
109
|
+
signing_key:
|
98
110
|
specification_version: 4
|
99
111
|
summary: Provides japanese conversion functionality for Strings using Ruby Refinements.
|
100
112
|
test_files: []
|
data/lib/mojiru/string.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'nkf'
|
4
|
-
|
5
|
-
module Mojiru
|
6
|
-
module String
|
7
|
-
UTF8_BOM = "\xEF\xBB\xBF"
|
8
|
-
|
9
|
-
def zen_to_han
|
10
|
-
NKF.nkf('-x -Z4 -W -w', self)
|
11
|
-
end
|
12
|
-
|
13
|
-
def han_to_zen
|
14
|
-
NKF.nkf('-W -w', self).tr('0-9a-zA-Z', '0-9a-zA-Z')
|
15
|
-
end
|
16
|
-
|
17
|
-
def hiragana
|
18
|
-
NKF.nkf('--hiragana -W -w', self)
|
19
|
-
end
|
20
|
-
|
21
|
-
def katakana
|
22
|
-
NKF.nkf('--katakana -W -w', self)
|
23
|
-
end
|
24
|
-
|
25
|
-
def normalize_zen_han
|
26
|
-
NKF.nkf('-m0Z1 -W -w', self)
|
27
|
-
end
|
28
|
-
|
29
|
-
def strip_blank
|
30
|
-
gsub(/\A[[:blank:]]+|[[:blank:]]+\Z/, '')
|
31
|
-
end
|
32
|
-
|
33
|
-
def prepend_utf8_bom
|
34
|
-
UTF8_BOM + self
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|