zenify 0.1.1 → 0.1.2

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: cc430b105b58d88bb6b827bfa0b0e8338aafcd7eb9dda63c8ed47ca10e5fb293
4
- data.tar.gz: 28b6db3c8a34553e18607bccf91371292d79ab9591f3941b292a65ae3e8cf39c
3
+ metadata.gz: 81b6543553f12e699d66998f92b667e5caa3d295cddd6e314d26335049cbe3f0
4
+ data.tar.gz: 7a504fc73c7426b0bbbe3715e41e4e1ae660bbfe4b47472b3038912e31eb3b46
5
5
  SHA512:
6
- metadata.gz: cb2c6af64fc02424b571082b2a3cd3d09215a5219e9d23093b99e7928fbb76ab316b6a6856cfcae17006f84afab110de145e0d0767a092f8ca755d6afa3e2ecf
7
- data.tar.gz: ac2d1e3a38b3b41b938fb1a0529178ad92934299037ae2e2104503cbbabb2bbb85f8636cef90bef75a21742cb8105eab8e134bff5262103570c2004462212231
6
+ metadata.gz: b0862fe27ad12c052ae0a83ce3fe0417bdf1dad3d0c4f9832c19e9c43d42ef465daaee4b78f6c48aeccf8d509afa6ce26880f8de97258c889b371e801ae5f9e6
7
+ data.tar.gz: d6cef2751234cab7d4bb3344075aab90cd4b47b73023357a9b69529383c5eee5cf7ae9d7d0f06831aa8cc34d0c7bcd40b7cf6e36980350cd810ebba5eb07465e
data/CHANGELOG.md CHANGED
@@ -1,9 +1,30 @@
1
- ## [Unreleased]
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ---
9
+
10
+ ## [0.1.2] - 2026-01-24
11
+ ### Added
12
+ - CLI option `--no-strip` to preserve leading and trailing spaces.
13
+ - Library API enhancement: `Zenify.normalize_spaces` now accepts `strip:` keyword argument.
14
+
15
+ ### Changed
16
+ - CLI help text updated to document the new option.
17
+
18
+ ---
2
19
 
3
20
  ## [0.1.1] - 2026-01-24
4
21
  ### Added
5
- - CLI: `--help` and `--version`
22
+ - Command-line interface (`zenify`) for normalizing whitespace.
23
+ - CLI options `--help` and `--version`.
6
24
 
7
- ## [0.1.0] - 2026-01-24
25
+ ---
8
26
 
9
- - Initial release
27
+ ## [0.1.0] - 2026-01-24
28
+ ### Added
29
+ - Initial release.
30
+ - `Zenify.normalize_spaces` for normalizing whitespace, including Japanese full-width spaces.
data/exe/zenify CHANGED
@@ -3,6 +3,8 @@
3
3
 
4
4
  require "zenify"
5
5
 
6
+ no_strip = ARGV.delete("--no-strip")
7
+
6
8
  if ARGV.include?("--version") || ARGV.include?("-v")
7
9
  puts Zenify::VERSION
8
10
  exit 0
@@ -11,20 +13,22 @@ end
11
13
  if ARGV.include?("--help") || ARGV.include?("-h")
12
14
  puts <<~HELP
13
15
  Usage:
14
- zenify "TEXT"
15
- echo "TEXT" | zenify
16
+ zenify [options] "TEXT"
17
+ echo "TEXT" | zenify [options]
16
18
 
17
19
  Options:
18
- -h, --help Show help
19
- -v, --version Show version
20
+ --no-strip Do not strip leading/trailing spaces
21
+ -h, --help Show help
22
+ -v, --version Show version
20
23
  HELP
21
24
  exit 0
22
25
  end
23
26
 
24
- input = if ARGV.empty?
25
- $stdin.read
26
- else
27
- ARGV.join(" ")
28
- end
27
+ input =
28
+ if ARGV.empty?
29
+ $stdin.read
30
+ else
31
+ ARGV.join(" ")
32
+ end
29
33
 
30
- puts Zenify.normalize_spaces(input)
34
+ puts Zenify.normalize_spaces(input, strip: !no_strip)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Zenify
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
data/lib/zenify.rb CHANGED
@@ -9,11 +9,13 @@ module Zenify
9
9
  # Normalize whitespace in a string:
10
10
  # - Convert Japanese full-width spaces to normal spaces
11
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
12
+ # - Optionally trim leading/trailing spaces (default: true)
13
+ def self.normalize_spaces(str, strip: true)
14
+ result =
15
+ str.to_s
16
+ .tr("\u3000", " ") # Convert full-width spaces to normal spaces
17
+ .gsub(/[ \t]+/, " ") # Collapse consecutive spaces/tabs into a single space
18
+
19
+ strip ? result.strip : result
18
20
  end
19
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zenify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryu Yamamoto