miyabi 0.2.1 → 0.3.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/.envrc +2 -0
- data/.gitignore +2 -0
- data/.rubocop_todo.yml +11 -11
- data/CHANGELOG.md +17 -0
- data/README.md +2 -0
- data/Rakefile +4 -0
- data/lib/check.rb +1 -1
- data/lib/format.rb +1 -1
- data/lib/miyabi/check_string.rb +16 -5
- data/lib/miyabi/format_string.rb +7 -3
- data/lib/miyabi/version.rb +1 -1
- data/manifest.scm +11 -0
- data/sig/miyabi.rbs +36 -0
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1103a78e1af969ad03b878f820fb9a7f0d9363dbe29aff68b7540dc1e7ff3949
|
4
|
+
data.tar.gz: 16371b54fef10e351692081b844b5d03c527526acd876f6a9d80afa36d20ba25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9141239952ac1a220b140a480c4a600a6ced23568128468384ca6a1be12fbcf02987243ca7b96268925b44588220504a056e4261b1a573dd78a47ee675d2810
|
7
|
+
data.tar.gz: db3caac3764db0c5bc5811d667a893f2a529a31c40f1aeef71c996c489f636ea0767d473e20b84df31ffae875df3f0b802e5813e12b4a9f43c5ff241c63a5cae
|
data/.envrc
ADDED
data/.gitignore
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2024-11-13 10:06:34 UTC using RuboCop version 1.48.1.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
9
|
# Offense count: 5
|
10
|
-
#
|
11
|
-
|
12
|
-
# ForbiddenPrefixes: is_, has_, have_
|
13
|
-
# AllowedMethods: is_a?
|
14
|
-
# MethodDefinitionMacros: define_method, define_singleton_method
|
15
|
-
Naming/PredicateName:
|
10
|
+
# This cop supports safe autocorrection (--autocorrect).
|
11
|
+
Layout/EmptyLineAfterGuardClause:
|
16
12
|
Exclude:
|
17
|
-
- '
|
18
|
-
|
13
|
+
- 'lib/miyabi/check_string.rb'
|
14
|
+
|
15
|
+
# Offense count: 1
|
16
|
+
# Configuration parameters: CountComments, CountAsOne.
|
17
|
+
Metrics/ModuleLength:
|
18
|
+
Max: 145
|
19
19
|
|
20
20
|
# Offense count: 3
|
21
21
|
# Configuration parameters: AllowedConstants.
|
@@ -23,6 +23,6 @@ Style/Documentation:
|
|
23
23
|
Exclude:
|
24
24
|
- 'spec/**/*'
|
25
25
|
- 'test/**/*'
|
26
|
-
- 'lib/check.rb'
|
27
|
-
- 'lib/format.rb'
|
28
26
|
- 'lib/miyabi.rb'
|
27
|
+
- 'lib/miyabi/check_string.rb'
|
28
|
+
- 'lib/miyabi/format_string.rb'
|
data/CHANGELOG.md
CHANGED
@@ -9,6 +9,23 @@ The format is based on [Keep a Changelog][cl], and this project adheres to [Sema
|
|
9
9
|
|
10
10
|
## [Unreleased]
|
11
11
|
|
12
|
+
## 0.3.1
|
13
|
+
|
14
|
+
This is a maintenance release.
|
15
|
+
|
16
|
+
* Lint source codes.
|
17
|
+
* Add RBS file.
|
18
|
+
|
19
|
+
## [0.3.0]
|
20
|
+
|
21
|
+
### Added
|
22
|
+
|
23
|
+
* method aliases: `hiragana?`, `hira?`, `japanese?`, `katakana?`, `kanji?`, `roman?`, `to_katakana?`, and `to_hiragana`.
|
24
|
+
|
25
|
+
### Others
|
26
|
+
|
27
|
+
* Add GNU Guix support.
|
28
|
+
|
12
29
|
## [0.2.1]
|
13
30
|
|
14
31
|
### Fixed
|
data/README.md
CHANGED
@@ -49,6 +49,8 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
49
49
|
|
50
50
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
51
51
|
|
52
|
+
If you use the GNU Guix, `guix shell` to enter the development environment, then `rake` to run tests.
|
53
|
+
|
52
54
|
## Contributing
|
53
55
|
|
54
56
|
Bug reports and pull requests are welcome on GitHub at https://github.com/h-akaishi/miyabi. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
data/Rakefile
CHANGED
data/lib/check.rb
CHANGED
data/lib/format.rb
CHANGED
data/lib/miyabi/check_string.rb
CHANGED
@@ -1,28 +1,39 @@
|
|
1
1
|
module Miyabi
|
2
2
|
module CheckString
|
3
|
-
def
|
3
|
+
def hiragana?
|
4
4
|
return true if self =~ /\p{hiragana}/
|
5
5
|
false
|
6
6
|
end
|
7
7
|
|
8
|
-
|
8
|
+
alias is_hira? hiragana?
|
9
|
+
alias hira? hiragana?
|
10
|
+
|
11
|
+
def japanese?
|
9
12
|
return true if self =~ /\A(?:\p{Hiragana}|\p{Katakana}|[ー-]|[一-龠々])+\z/
|
10
13
|
false
|
11
14
|
end
|
12
15
|
|
13
|
-
|
16
|
+
alias is_japanese? japanese?
|
17
|
+
|
18
|
+
def katakana?
|
14
19
|
return true if self =~ /\p{katakana}/
|
15
20
|
false
|
16
21
|
end
|
17
22
|
|
18
|
-
|
23
|
+
alias is_kana? katakana?
|
24
|
+
|
25
|
+
def kanji?
|
19
26
|
return true if self =~ /^[一-龥]+$/
|
20
27
|
false
|
21
28
|
end
|
22
29
|
|
23
|
-
|
30
|
+
alias is_kanji? kanji?
|
31
|
+
|
32
|
+
def roman?
|
24
33
|
return true if self =~ /^[a-zA-Z]+$/
|
25
34
|
false
|
26
35
|
end
|
36
|
+
|
37
|
+
alias is_roman? roman?
|
27
38
|
end
|
28
39
|
end
|
data/lib/miyabi/format_string.rb
CHANGED
@@ -12,13 +12,17 @@ module Miyabi
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def to_kana
|
15
|
-
|
15
|
+
tr('ぁ-ん', 'ァ-ン')
|
16
16
|
end
|
17
17
|
|
18
|
+
alias to_katakana to_kana
|
19
|
+
|
18
20
|
def to_hira
|
19
|
-
|
21
|
+
tr('ァ-ン', 'ぁ-ん')
|
20
22
|
end
|
21
23
|
|
24
|
+
alias to_hiragana to_hira
|
25
|
+
|
22
26
|
def to_roman
|
23
27
|
s = to_kana
|
24
28
|
KATAKANA_TO_ROMAN_MAPPING.each do |kana, roman|
|
@@ -147,7 +151,7 @@ module Miyabi
|
|
147
151
|
'ペ' => 'pe',
|
148
152
|
'ポ' => 'po',
|
149
153
|
'ヴ' => 'vu',
|
150
|
-
'ー' => '-'
|
154
|
+
'ー' => '-'
|
151
155
|
}
|
152
156
|
|
153
157
|
private_constant :KATAKANA_TO_ROMAN_MAPPING
|
data/lib/miyabi/version.rb
CHANGED
data/manifest.scm
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
(use-modules (guix packages)
|
2
|
+
(gnu packages ruby))
|
3
|
+
|
4
|
+
(define-public ruby-nokogiri'
|
5
|
+
(package
|
6
|
+
(inherit ruby-nokogiri)
|
7
|
+
(arguments
|
8
|
+
(cons* #:ruby ruby-3.2
|
9
|
+
(package-arguments ruby-nokogiri)))))
|
10
|
+
|
11
|
+
(packages->manifest (list ruby-nokogiri' ruby-rspec ruby-3.2 ruby-rubocop))
|
data/sig/miyabi.rbs
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# TypeProf 0.21.3
|
2
|
+
|
3
|
+
# Classes
|
4
|
+
class String
|
5
|
+
include Miyabi::FormatString
|
6
|
+
include Miyabi::CheckString
|
7
|
+
end
|
8
|
+
|
9
|
+
module Miyabi
|
10
|
+
VERSION: String
|
11
|
+
|
12
|
+
module CheckString
|
13
|
+
def hiragana?: -> bool
|
14
|
+
alias is_hira? hiragana?
|
15
|
+
alias hira? hiragana?
|
16
|
+
def japanese?: -> bool
|
17
|
+
alias is_japanese? japanese?
|
18
|
+
def katakana?: -> bool
|
19
|
+
alias is_kana? katakana?
|
20
|
+
def kanji?: -> bool
|
21
|
+
alias is_kanji? kanji?
|
22
|
+
def roman?: -> bool
|
23
|
+
alias is_roman? roman?
|
24
|
+
end
|
25
|
+
|
26
|
+
module FormatString
|
27
|
+
KATAKANA_TO_ROMAN_MAPPING: Hash[String, String]
|
28
|
+
|
29
|
+
def to_kanhira: -> String
|
30
|
+
def to_kana: -> String
|
31
|
+
alias to_katakana to_kana
|
32
|
+
def to_hira: -> String
|
33
|
+
alias to_hiragana to_hira
|
34
|
+
def to_roman: -> String
|
35
|
+
end
|
36
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: miyabi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hironori Akaishi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -45,6 +45,7 @@ executables: []
|
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
|
+
- ".envrc"
|
48
49
|
- ".gitignore"
|
49
50
|
- ".rspec"
|
50
51
|
- ".rubocop.yml"
|
@@ -64,7 +65,9 @@ files:
|
|
64
65
|
- lib/miyabi/check_string.rb
|
65
66
|
- lib/miyabi/format_string.rb
|
66
67
|
- lib/miyabi/version.rb
|
68
|
+
- manifest.scm
|
67
69
|
- miyabi.gemspec
|
70
|
+
- sig/miyabi.rbs
|
68
71
|
homepage: https://github.com/isy/miyabi
|
69
72
|
licenses:
|
70
73
|
- MIT
|
@@ -85,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
85
88
|
- !ruby/object:Gem::Version
|
86
89
|
version: '0'
|
87
90
|
requirements: []
|
88
|
-
rubygems_version: 3.4.
|
91
|
+
rubygems_version: 3.4.19
|
89
92
|
signing_key:
|
90
93
|
specification_version: 4
|
91
94
|
summary: kana,hira,kanji formatter
|