mojiru 0.1.0 → 0.2.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: 8256c7a48e1177c542683f9a0a784070b70f140ed981e81b04761af80b352fb1
4
+ data.tar.gz: 87f3ab401b6bfca6151afd502d3ee38e6b65ec7e0e6876f87dc47bbd32d76240
5
5
  SHA512:
6
- metadata.gz: 7ca83d358c411df4bb73896afe9aad1ddf5e8651aeeceb191c26a3504b0ddf0b32e58277c7c483606554bf62a1384c4b937343ae1759c12493b96c2f82e1ceb2
7
- data.tar.gz: 2ad0ad0b556166fe6b123afaeeba3ec0219dc75416b884540dc2370e8484a5ede727cab644a65da61ed6479b6bf657fc41f0df86c1c355c16e4322fc3133a730
6
+ metadata.gz: f45949300d50e727cb6cb5ad2dc91f333b9123f4b0ce61dbdb7d49b9864b64cd2a053ac0a3a3bbb0ab2121f6eb7d08ae6b8738434f7bd74b6317410c4866a607
7
+ data.tar.gz: 0755ee9884af21caa451458caf9b7fb13ec76e4a5aa8237ed02447e6e9b4e43c28d20d87a342531d9b9723749ce656c29c87608abed8c6cc9dd7841a59a08ebf
@@ -1,3 +1,3 @@
1
1
  module Mojiru
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.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,7 @@ 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_development_dependency "bundler"
24
+ spec.add_development_dependency "rake"
25
+ spec.add_development_dependency "rspec"
26
26
  end
metadata CHANGED
@@ -1,57 +1,57 @@
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.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - aki77
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-06-02 00:00:00.000000000 Z
11
+ date: 2022-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.16'
19
+ version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.16'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '3.0'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '3.0'
54
+ version: '0'
55
55
  description: Provides japanese conversion functionality for Strings using Ruby Refinements.
56
56
  email:
57
57
  - aki77@users.noreply.github.com
@@ -70,7 +70,6 @@ files:
70
70
  - bin/console
71
71
  - bin/setup
72
72
  - lib/mojiru.rb
73
- - lib/mojiru/string.rb
74
73
  - lib/mojiru/version.rb
75
74
  - mojiru.gemspec
76
75
  homepage: https://github.com/aki77/mojiru
@@ -92,8 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
91
  - !ruby/object:Gem::Version
93
92
  version: '0'
94
93
  requirements: []
95
- rubyforge_project:
96
- rubygems_version: 2.6.14
94
+ rubygems_version: 3.1.2
97
95
  signing_key:
98
96
  specification_version: 4
99
97
  summary: Provides japanese conversion functionality for Strings using Ruby Refinements.
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