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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff4cce51bc6a0dd5533d754d2df91cb70b79bacf43fef0d8bb543894931118a9
4
- data.tar.gz: 5523168b8206d1fa59601abb7ce23c5886de7b5948fa0820dac28c96a5b4570f
3
+ metadata.gz: 1103a78e1af969ad03b878f820fb9a7f0d9363dbe29aff68b7540dc1e7ff3949
4
+ data.tar.gz: 16371b54fef10e351692081b844b5d03c527526acd876f6a9d80afa36d20ba25
5
5
  SHA512:
6
- metadata.gz: 1acb6a56705b8f019171b624c1f68b78a2328118e0726cb054f10f19084c053f19722f65a0fc88b474a51e6c36b5cb22b36f193655a4f4049a8b10bd8c6241b7
7
- data.tar.gz: 56c8c59c54ef513ffee048bd4342b79e7e4847b74ef639a11fe2613a53ba519ce96f7e45f3080e3abe5fe308579dc2ed40be621c24e275aec89727c43c017f42
6
+ metadata.gz: b9141239952ac1a220b140a480c4a600a6ced23568128468384ca6a1be12fbcf02987243ca7b96268925b44588220504a056e4261b1a573dd78a47ee675d2810
7
+ data.tar.gz: db3caac3764db0c5bc5811d667a893f2a529a31c40f1aeef71c996c489f636ea0767d473e20b84df31ffae875df3f0b802e5813e12b4a9f43c5ff241c63a5cae
data/.envrc ADDED
@@ -0,0 +1,2 @@
1
+ watch_file manifest.scm
2
+ use guix
data/.gitignore CHANGED
@@ -10,3 +10,5 @@
10
10
 
11
11
  # rspec failure tracking
12
12
  .rspec_status
13
+
14
+ /sig/miyabi.gen.rbs
data/.rubocop_todo.yml CHANGED
@@ -1,21 +1,21 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2023-05-13 02:36:18 UTC using RuboCop version 1.50.2.
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
- # Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros.
11
- # NamePrefix: is_, has_, have_
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
- - 'spec/**/*'
18
- - 'lib/check.rb'
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
@@ -4,3 +4,7 @@ require 'rspec/core/rake_task'
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
6
  task default: :spec
7
+
8
+ task :gensig do
9
+ sh 'typeprof', '-r', 'nokogiri', '-o', 'sig/miyabi.gen.rbs', 'sig/miyabi.rbs', *Dir['lib/**/*.rb']
10
+ end
data/lib/check.rb CHANGED
@@ -1,4 +1,4 @@
1
- require_relative "miyabi/check_string"
1
+ require_relative 'miyabi/check_string'
2
2
 
3
3
  class String
4
4
  include ::Miyabi::CheckString
data/lib/format.rb CHANGED
@@ -1,4 +1,4 @@
1
- require_relative "miyabi/format_string"
1
+ require_relative 'miyabi/format_string'
2
2
 
3
3
  class String
4
4
  include ::Miyabi::FormatString
@@ -1,28 +1,39 @@
1
1
  module Miyabi
2
2
  module CheckString
3
- def is_hira?
3
+ def hiragana?
4
4
  return true if self =~ /\p{hiragana}/
5
5
  false
6
6
  end
7
7
 
8
- def is_japanese?
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
- def is_kana?
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
- def is_kanji?
23
+ alias is_kana? katakana?
24
+
25
+ def kanji?
19
26
  return true if self =~ /^[一-龥]+$/
20
27
  false
21
28
  end
22
29
 
23
- def is_roman?
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
@@ -12,13 +12,17 @@ module Miyabi
12
12
  end
13
13
 
14
14
  def to_kana
15
- self.tr('ぁ-ん','ァ-ン')
15
+ tr('ぁ-ん', 'ァ-ン')
16
16
  end
17
17
 
18
+ alias to_katakana to_kana
19
+
18
20
  def to_hira
19
- self.tr('ァ-ン','ぁ-ん')
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
@@ -1,3 +1,3 @@
1
1
  module Miyabi
2
- VERSION = '0.2.1'
2
+ VERSION = '0.3.1'
3
3
  end
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.2.1
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: 2023-06-17 00:00:00.000000000 Z
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.10
91
+ rubygems_version: 3.4.19
89
92
  signing_key:
90
93
  specification_version: 4
91
94
  summary: kana,hira,kanji formatter