zenify 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: cc430b105b58d88bb6b827bfa0b0e8338aafcd7eb9dda63c8ed47ca10e5fb293
4
+ data.tar.gz: 28b6db3c8a34553e18607bccf91371292d79ab9591f3941b292a65ae3e8cf39c
5
+ SHA512:
6
+ metadata.gz: cb2c6af64fc02424b571082b2a3cd3d09215a5219e9d23093b99e7928fbb76ab316b6a6856cfcae17006f84afab110de145e0d0767a092f8ca755d6afa3e2ecf
7
+ data.tar.gz: ac2d1e3a38b3b41b938fb1a0529178ad92934299037ae2e2104503cbbabb2bbb85f8636cef90bef75a21742cb8105eab8e134bff5262103570c2004462212231
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="AgentMigrationStateService">
4
+ <option name="migrationStatus" value="COMPLETED" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="AskMigrationStateService">
4
+ <option name="migrationStatus" value="COMPLETED" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="Ask2AgentMigrationStateService">
4
+ <option name="migrationStatus" value="COMPLETED" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="EditMigrationStateService">
4
+ <option name="migrationStatus" value="COMPLETED" />
5
+ </component>
6
+ </project>
data/.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/zenify.iml" filepath="$PROJECT_DIR$/.idea/zenify.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
data/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="" vcs="Git" />
5
+ </component>
6
+ </project>
data/.idea/zenify.iml ADDED
@@ -0,0 +1,44 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="RUBY_MODULE" version="4">
3
+ <component name="ModuleRunConfigurationManager">
4
+ <shared />
5
+ </component>
6
+ <component name="NewModuleRootManager">
7
+ <content url="file://$MODULE_DIR$">
8
+ <sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
9
+ <sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
10
+ <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
11
+ </content>
12
+ <orderEntry type="jdk" jdkName="mise: 3.4.8" jdkType="RUBY_SDK" />
13
+ <orderEntry type="sourceFolder" forTests="false" />
14
+ <orderEntry type="library" scope="PROVIDED" name="ast (v2.4.3, mise: 3.4.8) [gem]" level="application" />
15
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v4.0.1, mise: 3.4.8) [gem]" level="application" />
16
+ <orderEntry type="library" scope="PROVIDED" name="date (v3.5.1, mise: 3.4.8) [gem]" level="application" />
17
+ <orderEntry type="library" scope="PROVIDED" name="erb (v6.0.1, mise: 3.4.8) [gem]" level="application" />
18
+ <orderEntry type="library" scope="PROVIDED" name="io-console (v0.8.2, mise: 3.4.8) [gem]" level="application" />
19
+ <orderEntry type="library" scope="PROVIDED" name="irb (v1.16.0, mise: 3.4.8) [gem]" level="application" />
20
+ <orderEntry type="library" scope="PROVIDED" name="json (v2.18.0, mise: 3.4.8) [gem]" level="application" />
21
+ <orderEntry type="library" scope="PROVIDED" name="language_server-protocol (v3.17.0.5, mise: 3.4.8) [gem]" level="application" />
22
+ <orderEntry type="library" scope="PROVIDED" name="lint_roller (v1.1.0, mise: 3.4.8) [gem]" level="application" />
23
+ <orderEntry type="library" scope="PROVIDED" name="minitest (v5.27.0, mise: 3.4.8) [gem]" level="application" />
24
+ <orderEntry type="library" scope="PROVIDED" name="parallel (v1.27.0, mise: 3.4.8) [gem]" level="application" />
25
+ <orderEntry type="library" scope="PROVIDED" name="parser (v3.3.10.1, mise: 3.4.8) [gem]" level="application" />
26
+ <orderEntry type="library" scope="PROVIDED" name="pp (v0.6.3, mise: 3.4.8) [gem]" level="application" />
27
+ <orderEntry type="library" scope="PROVIDED" name="prettyprint (v0.2.0, mise: 3.4.8) [gem]" level="application" />
28
+ <orderEntry type="library" scope="PROVIDED" name="prism (v1.8.0, mise: 3.4.8) [gem]" level="application" />
29
+ <orderEntry type="library" scope="PROVIDED" name="psych (v5.3.1, mise: 3.4.8) [gem]" level="application" />
30
+ <orderEntry type="library" scope="PROVIDED" name="racc (v1.8.1, mise: 3.4.8) [gem]" level="application" />
31
+ <orderEntry type="library" scope="PROVIDED" name="rainbow (v3.1.1, mise: 3.4.8) [gem]" level="application" />
32
+ <orderEntry type="library" scope="PROVIDED" name="rake (v13.3.1, mise: 3.4.8) [gem]" level="application" />
33
+ <orderEntry type="library" scope="PROVIDED" name="rdoc (v7.1.0, mise: 3.4.8) [gem]" level="application" />
34
+ <orderEntry type="library" scope="PROVIDED" name="regexp_parser (v2.11.3, mise: 3.4.8) [gem]" level="application" />
35
+ <orderEntry type="library" scope="PROVIDED" name="reline (v0.6.3, mise: 3.4.8) [gem]" level="application" />
36
+ <orderEntry type="library" scope="PROVIDED" name="rubocop (v1.82.1, mise: 3.4.8) [gem]" level="application" />
37
+ <orderEntry type="library" scope="PROVIDED" name="rubocop-ast (v1.49.0, mise: 3.4.8) [gem]" level="application" />
38
+ <orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.13.0, mise: 3.4.8) [gem]" level="application" />
39
+ <orderEntry type="library" scope="PROVIDED" name="stringio (v3.2.0, mise: 3.4.8) [gem]" level="application" />
40
+ <orderEntry type="library" scope="PROVIDED" name="tsort (v0.2.0, mise: 3.4.8) [gem]" level="application" />
41
+ <orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v3.2.0, mise: 3.4.8) [gem]" level="application" />
42
+ <orderEntry type="library" scope="PROVIDED" name="unicode-emoji (v4.2.0, mise: 3.4.8) [gem]" level="application" />
43
+ </component>
44
+ </module>
data/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.1] - 2026-01-24
4
+ ### Added
5
+ - CLI: `--help` and `--version`
6
+
7
+ ## [0.1.0] - 2026-01-24
8
+
9
+ - Initial release
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2026 Ryu Yamamoto
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,71 @@
1
+ # Zenify
2
+
3
+ Zenify is a tiny Ruby utility gem that normalizes whitespace in strings.
4
+
5
+ It is especially useful when dealing with Japanese text, as it converts
6
+ full-width spaces (全角スペース) into normal spaces and collapses consecutive
7
+ whitespace into a single space.
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ gem "zenify"
14
+
15
+ And then execute:
16
+
17
+ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ gem install zenify
22
+
23
+ ## Usage
24
+
25
+ require "zenify"
26
+
27
+ Zenify.normalize_spaces(" a  b ")
28
+ # => "a b"
29
+
30
+ Zenify.normalize_spaces(" こんにちは  世界 ")
31
+ # => "こんにちは 世界"
32
+
33
+ ### CLI
34
+ You can also use Zenify from the command line:
35
+
36
+ zenify " a  b "
37
+ # => a b
38
+
39
+ echo " a  b " | zenify
40
+ # => a b
41
+
42
+ zenify --help
43
+ zenify --version
44
+
45
+ ## Development
46
+
47
+ After checking out the repo, run:
48
+
49
+ bin/setup
50
+
51
+ Then run the tests:
52
+
53
+ bundle exec rake test
54
+
55
+ You can also experiment in an interactive console:
56
+
57
+ bin/console
58
+
59
+ To install this gem onto your local machine:
60
+
61
+ bundle exec rake install
62
+
63
+ ## Contributing
64
+
65
+ Bug reports and pull requests are welcome on GitHub:
66
+
67
+ https://github.com/ryu/zenify
68
+
69
+ ## License
70
+
71
+ The gem is available as open source under the terms of the MIT License.
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "minitest/test_task"
5
+
6
+ Minitest::TestTask.create
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[test rubocop]
data/bin/console ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "zenify"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ require "irb"
11
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/exe/zenify ADDED
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "zenify"
5
+
6
+ if ARGV.include?("--version") || ARGV.include?("-v")
7
+ puts Zenify::VERSION
8
+ exit 0
9
+ end
10
+
11
+ if ARGV.include?("--help") || ARGV.include?("-h")
12
+ puts <<~HELP
13
+ Usage:
14
+ zenify "TEXT"
15
+ echo "TEXT" | zenify
16
+
17
+ Options:
18
+ -h, --help Show help
19
+ -v, --version Show version
20
+ HELP
21
+ exit 0
22
+ end
23
+
24
+ input = if ARGV.empty?
25
+ $stdin.read
26
+ else
27
+ ARGV.join(" ")
28
+ end
29
+
30
+ puts Zenify.normalize_spaces(input)
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Zenify
4
+ VERSION = "0.1.1"
5
+ end
data/lib/zenify.rb ADDED
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "zenify/version"
4
+
5
+ # Zenify provides small text normalization utilities.
6
+ module Zenify
7
+ class Error < StandardError; end
8
+
9
+ # Normalize whitespace in a string:
10
+ # - Convert Japanese full-width spaces to normal spaces
11
+ # - Collapse consecutive spaces/tabs into a single space
12
+ # - Trim leading/trailing spaces
13
+ def self.normalize_spaces(text)
14
+ text.to_s
15
+ .tr("\u3000", " ") # Convert full-width spaces to normal spaces
16
+ .gsub(/[ \t]+/, " ") # Collapse consecutive spaces/tabs into a single space
17
+ .strip # Trim leading/trailing spaces
18
+ end
19
+ end
data/sig/zenify.rbs ADDED
@@ -0,0 +1,4 @@
1
+ module Zenify
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,64 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: zenify
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Ryu Yamamoto
8
+ bindir: exe
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies: []
12
+ description: Zenify provides a small utility to normalize whitespace in strings, including
13
+ Japanese full-width spaces.
14
+ email:
15
+ - ryu.yamamoto@icloud.com
16
+ executables:
17
+ - zenify
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - ".idea/copilot.data.migration.agent.xml"
22
+ - ".idea/copilot.data.migration.ask.xml"
23
+ - ".idea/copilot.data.migration.ask2agent.xml"
24
+ - ".idea/copilot.data.migration.edit.xml"
25
+ - ".idea/modules.xml"
26
+ - ".idea/vcs.xml"
27
+ - ".idea/zenify.iml"
28
+ - CHANGELOG.md
29
+ - LICENSE.txt
30
+ - README.md
31
+ - Rakefile
32
+ - bin/console
33
+ - bin/setup
34
+ - exe/zenify
35
+ - lib/zenify.rb
36
+ - lib/zenify/version.rb
37
+ - sig/zenify.rbs
38
+ homepage: https://github.com/ryu/zenify
39
+ licenses:
40
+ - MIT
41
+ metadata:
42
+ homepage_uri: https://github.com/ryu/zenify
43
+ source_code_uri: https://github.com/ryu/zenify
44
+ documentation_uri: https://github.com/ryu/zenify#readme
45
+ changelog_uri: https://github.com/ryu/zenify/blob/main/CHANGELOG.md
46
+ rubygems_mfa_required: 'true'
47
+ rdoc_options: []
48
+ require_paths:
49
+ - lib
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 3.4.0
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ requirements: []
61
+ rubygems_version: 4.0.4
62
+ specification_version: 4
63
+ summary: Normalize whitespace in strings.
64
+ test_files: []