slug-wordcount-e548a0 0.3291.15937

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: f8c2123abfdcd57d7b7d81002652796942422973e248c4b14210f14adb434ad1
4
+ data.tar.gz: af3cad4c8eced848bd58cdec2231a1483898517e787d07f7bf8830be2dcaaa99
5
+ SHA512:
6
+ metadata.gz: 5e444a6b7a3945533d33b7e8b803743774f269e7b31bbbdaa0b8f854dbd17496c250681d86b0d58dd37f2375a7df6e328a606aeafd7dfd55140a74f9ec67a939
7
+ data.tar.gz: 756c5807e0da77c15f9795312f7a9abb12765b550139c6ebeeabb6226daedfd976ca51e67f1122b82f414b5deab7bb8b572e16710ac7a443be5a6e460f38e0ef
data/LICENSE ADDED
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Textkit maintainers
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,33 @@
1
+ # slug-wordcount-e548a0
2
+
3
+ Small, dependency-free text helpers: build URL slugs, count words and estimate reading time.
4
+
5
+ ## Installation
6
+
7
+ ```
8
+ gem install slug-wordcount-e548a0
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```ruby
14
+ require "slug-wordcount-e548a0"
15
+
16
+ SlugWordcountE548a0.slugify("Hello, World!") # => "hello-world"
17
+ SlugWordcountE548a0.word_count("one two three") # => 3
18
+ SlugWordcountE548a0.reading_time("word " * 250) # => 2
19
+ ```
20
+
21
+ ## API
22
+
23
+ - `SlugWordcountE548a0.slugify(text, separator = "-")`: lowercase ASCII slug (common Latin accents folded to their base letter, runs of letters and digits joined by the separator, `-` by default).
24
+ - `SlugWordcountE548a0.word_count(text)`: number of words.
25
+ - `SlugWordcountE548a0.reading_time(text, words_per_minute = 200)`: reading time in minutes, rounded up (200 words per minute by default, 0 for an empty text).
26
+
27
+ ## See also
28
+
29
+ - [https://www.hypnozero.com/](https://www.hypnozero.com/)
30
+
31
+ ## License
32
+
33
+ MIT
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Small text helpers: slugify, word count and reading time.
4
+ module SlugWordcountE548a0
5
+ VERSION = "0.3291.15937"
6
+
7
+ module_function
8
+
9
+ def slugify(text, separator = "-")
10
+ ascii = text.to_s.unicode_normalize(:nfkd)
11
+ .encode("ASCII", invalid: :replace, undef: :replace, replace: "")
12
+ ascii.downcase.scan(/[a-z0-9]+/).join(separator)
13
+ end
14
+
15
+ def word_count(text)
16
+ text.to_s.scan(/\w+/).length
17
+ end
18
+
19
+ def reading_time(text, words_per_minute = 200)
20
+ raise ArgumentError, "words_per_minute must be positive" unless words_per_minute.positive?
21
+
22
+ (word_count(text) + words_per_minute - 1) / words_per_minute
23
+ end
24
+ end
metadata ADDED
@@ -0,0 +1,46 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: "slug-wordcount-e548a0"
3
+ version: !ruby/object:Gem::Version
4
+ version: "0.3291.15937"
5
+ platform: ruby
6
+ authors:
7
+ - "Textkit maintainers"
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2026-11-27 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: "Small dependency-free text helpers: slugify, word count and reading time."
14
+ email:
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - "LICENSE"
20
+ - "README.md"
21
+ - "lib/slug-wordcount-e548a0.rb"
22
+ homepage: "https://www.hypnozero.com/"
23
+ licenses:
24
+ - MIT
25
+ metadata:
26
+ homepage_uri: "https://www.hypnozero.com/"
27
+ post_install_message:
28
+ rdoc_options: []
29
+ require_paths:
30
+ - lib
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: '2.7'
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ requirements: []
42
+ rubygems_version: 3.5.22
43
+ signing_key:
44
+ specification_version: 4
45
+ summary: "Small dependency-free text helpers: slugify, word count and reading time."
46
+ test_files: []