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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 5450e47d4f7272ba2ac84c0e905598437a779b26
4
- data.tar.gz: dfcaf92f30ab0f28d25d5bcddc33d63bfb30366c
2
+ SHA256:
3
+ metadata.gz: a16e1836606e71e84b25e74fac894e38ee11a02de80cd18882d8a604ff779e44
4
+ data.tar.gz: da65e239b865a5d39020f89ba22588c8e26d4b68c529311fbd2015b9d6244654
5
5
  SHA512:
6
- metadata.gz: 7ca83d358c411df4bb73896afe9aad1ddf5e8651aeeceb191c26a3504b0ddf0b32e58277c7c483606554bf62a1384c4b937343ae1759c12493b96c2f82e1ceb2
7
- data.tar.gz: 2ad0ad0b556166fe6b123afaeeba3ec0219dc75416b884540dc2370e8484a5ede727cab644a65da61ed6479b6bf657fc41f0df86c1c355c16e4322fc3133a730
6
+ metadata.gz: 9b05cb57596e2f08130de35a99cdb4fc620315e507a9a87275f333f6676568b9d61987d863626a37453168bac40cd6d91fb6a427541c0ffdd19ab4f270eeb4ab
7
+ data.tar.gz: d1dc4a292fdad190c9f119c576078111f04412f180aef21abad74c479ce0c3602e65a790cabaeb05d7af74e80f9d891931e330fcce86b56568ddae27e6ec9734
@@ -1,3 +1,3 @@
1
1
  module Mojiru
2
- VERSION = "0.1.0"
2
+ VERSION = "0.3.0"
3
3
  end
data/lib/mojiru.rb CHANGED
@@ -1,8 +1,36 @@
1
1
  require 'mojiru/version'
2
- require 'mojiru/string'
2
+ require 'nkf'
3
3
 
4
4
  module Mojiru
5
+ UTF8_BOM = "\xEF\xBB\xBF"
6
+
5
7
  refine ::String do
6
- include String
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.add_development_dependency "bundler", "~> 1.16"
24
- spec.add_development_dependency "rake", "~> 10.0"
25
- spec.add_development_dependency "rspec", "~> 3.0"
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.1.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: 2018-06-02 00:00:00.000000000 Z
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: '1.16'
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: '1.16'
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: '10.0'
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: '10.0'
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: '3.0'
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: '3.0'
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
- rubyforge_project:
96
- rubygems_version: 2.6.14
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