philiprehberger-slug 0.3.0 → 0.4.0

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: c6417c2057ab93e96dd94c6427ea1176a9e90b0827a03e5b54d69cc88d2265b0
4
- data.tar.gz: 34cd902c8265b577a5c991c5d49ef4e142b8cbf5a823d4645e055429202d715d
3
+ metadata.gz: ca5f046f1ee001cf812dec361b6ba178a83c0028337fd8782638acb73ac7b66d
4
+ data.tar.gz: 89f3d660821048c7f5beda317de4df2921b34d05ede640f1720deb666eb1470a
5
5
  SHA512:
6
- metadata.gz: 1a76c62679ff50297c41caec2943def332006ed1b04936807e4c437c4bc1b029ffdd0827380ad204721232b55144db4f999f7c828135c31373b596f65c07ad4d
7
- data.tar.gz: 799fc05c9c45cf4e179bf9b116074fa378acb5523366b6539e64847d8f9d864a363fe3448d4fc9c58ec3e9e92f6736ccb1cd820478c30e097f3fbe06d19c370f
6
+ metadata.gz: 641d425370b27bba56a73b3a9170afdefa36f8b673a1e0f6b4b8e5e66372ee716745f4f7adf33fb31e0af3a528744124474d1a983a591b6a0a2ce3777b4332e0
7
+ data.tar.gz: 26b5610ba47ceb1fd4cbc9135d1bdbe69f1ea7a7198bf38e6691e557bc454e9f73844b3214ae0498f8439c572e25cb99bc07e8a35be8f7780383fce5c25d9474
data/CHANGELOG.md CHANGED
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.4.0] - 2026-04-15
11
+
12
+ ### Added
13
+ - `Slug.parameterize` — Rails-compatible alias for `generate`
14
+
10
15
  ## [0.3.0] - 2026-04-13
11
16
 
12
17
  ### Added
data/README.md CHANGED
@@ -104,11 +104,20 @@ Philiprehberger::Slug.humanize("hello_world", separator: "_") # => "Hello
104
104
  Philiprehberger::Slug.transliterate("café résumé") # => "cafe resume"
105
105
  ```
106
106
 
107
+ ### Rails-compatible Alias
108
+
109
+ For callers familiar with `ActiveSupport::Inflector#parameterize`:
110
+
111
+ ```ruby
112
+ Philiprehberger::Slug.parameterize("Hello World!") # => "hello-world"
113
+ ```
114
+
107
115
  ## API
108
116
 
109
117
  | Method | Description |
110
118
  |--------|-------------|
111
119
  | `Slug.generate(string, separator:, max:, unique:, custom_mapping:)` | Generate a URL-safe slug from any string |
120
+ | `Slug.parameterize(string, separator:, max:, custom_mapping:)` | Rails-compatible alias for `generate` |
112
121
  | `Slug.generate_batch(strings, separator:, max:, custom_mapping:)` | Generate unique slugs for an array of strings with deduplication |
113
122
  | `Slug.valid_slug?(string, separator:)` | Check whether a string is a well-formed slug |
114
123
  | `Slug.humanize(slug, separator:, capitalize:)` | Convert a slug back to a human-readable title |
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Philiprehberger
4
4
  module Slug
5
- VERSION = '0.3.0'
5
+ VERSION = '0.4.0'
6
6
  end
7
7
  end
@@ -21,6 +21,18 @@ module Philiprehberger
21
21
  Generator.call(string, separator: separator, max: max, unique: unique, custom_mapping: custom_mapping)
22
22
  end
23
23
 
24
+ # Rails-compatible alias for `generate` for callers familiar with
25
+ # `ActiveSupport::Inflector#parameterize`.
26
+ #
27
+ # @param string [String] the input string
28
+ # @param separator [String] the separator character
29
+ # @param max [Integer, nil] maximum length, truncated at word boundary
30
+ # @param custom_mapping [Hash, nil] custom character replacements
31
+ # @return [String] the generated slug
32
+ def self.parameterize(string, separator: '-', max: nil, custom_mapping: nil)
33
+ generate(string, separator: separator, max: max, custom_mapping: custom_mapping)
34
+ end
35
+
24
36
  # Generate unique slugs for an array of strings with automatic deduplication
25
37
  #
26
38
  # @param strings [Array<String>] the input strings
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: philiprehberger-slug
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philip Rehberger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-04-13 00:00:00.000000000 Z
11
+ date: 2026-04-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Generate URL-safe slugs from any string with built-in Unicode transliteration,
14
14
  configurable separators, word-boundary truncation, and collision-aware uniqueness.