mohitkhare 0.1.0 → 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 +4 -4
- data/lib/mohitkhare.rb +61 -2
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b49a803811204358a65a54490fa927938ba44b83965472ebed264a7d23b5fb41
|
|
4
|
+
data.tar.gz: 73ca2621e19b31f9843b4844783fc59fe1b4de2783fdb76607ff1c4627771191
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ad2912d07fed3ee42e8457611585064f4df0599151469045d55d9504747345d5d81c3604187f1ac33cd5827b6fc078125adbca95e8996666c0e5a62ebed485f6
|
|
7
|
+
data.tar.gz: 7ec9b77be8f75bc7c742bb5b9a1441c8f43f9b51466a21e4d66e45ec1bdd9422aa949d51cbba76787d4a49f22623f1a0f5d7e59f8f345f227c9e672d3f129aca
|
data/lib/mohitkhare.rb
CHANGED
|
@@ -1,17 +1,76 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
#
|
|
3
|
+
# MohitKhare - Developer utilities and text analysis tools
|
|
4
4
|
# https://mohitkhare.me
|
|
5
|
+
#
|
|
6
|
+
# Token estimation, word counting, and text helpers for Ruby projects.
|
|
5
7
|
|
|
6
8
|
module MohitKhare
|
|
7
|
-
VERSION = '0.1.
|
|
9
|
+
VERSION = '0.1.1'
|
|
8
10
|
|
|
9
11
|
BASE_URL = 'https://mohitkhare.me'
|
|
10
12
|
|
|
13
|
+
DESCRIPTION = 'Developer utilities for text analysis and token estimation, extracted from mohitkhare.me tooling.'
|
|
14
|
+
|
|
15
|
+
ENDPOINTS = {
|
|
16
|
+
home: '/',
|
|
17
|
+
blog: '/blog',
|
|
18
|
+
projects: '/projects'
|
|
19
|
+
}.freeze
|
|
20
|
+
|
|
21
|
+
@config = {}
|
|
22
|
+
|
|
23
|
+
# Returns library metadata
|
|
24
|
+
def self.info
|
|
25
|
+
{
|
|
26
|
+
name: 'MohitKhare',
|
|
27
|
+
version: VERSION,
|
|
28
|
+
base_url: BASE_URL,
|
|
29
|
+
description: DESCRIPTION,
|
|
30
|
+
endpoints: ENDPOINTS.keys
|
|
31
|
+
}
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Returns available endpoint paths
|
|
35
|
+
def self.endpoints
|
|
36
|
+
ENDPOINTS
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Estimate token count for a string (LLM-style ~4 chars/token heuristic)
|
|
40
|
+
#
|
|
41
|
+
# @param text [String] the input text
|
|
42
|
+
# @return [Integer] estimated token count
|
|
43
|
+
def self.estimate_tokens(text)
|
|
44
|
+
return 0 if text.nil? || text.empty?
|
|
45
|
+
(text.length / 4.0).ceil
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Count words in a string
|
|
49
|
+
#
|
|
50
|
+
# @param text [String] the input text
|
|
51
|
+
# @return [Integer] word count
|
|
52
|
+
def self.word_count(text)
|
|
53
|
+
return 0 if text.nil? || text.empty?
|
|
54
|
+
text.split(/\s+/).reject(&:empty?).length
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Block-based configuration
|
|
58
|
+
def self.configure
|
|
59
|
+
yield @config if block_given?
|
|
60
|
+
@config
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Read current configuration
|
|
64
|
+
def self.config
|
|
65
|
+
@config
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# Returns the current library version
|
|
11
69
|
def self.version
|
|
12
70
|
VERSION
|
|
13
71
|
end
|
|
14
72
|
|
|
73
|
+
# Returns the base URL
|
|
15
74
|
def self.base_url
|
|
16
75
|
BASE_URL
|
|
17
76
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mohitkhare
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mohit Khare
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-03-
|
|
11
|
+
date: 2026-03-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Developer utilities from Mohit Khare including token counting, text analysis,
|
|
14
14
|
and AI engineering helper functions.
|
|
@@ -23,9 +23,9 @@ licenses:
|
|
|
23
23
|
- MIT
|
|
24
24
|
metadata:
|
|
25
25
|
homepage_uri: https://mohitkhare.me
|
|
26
|
-
source_code_uri: https://github.com/
|
|
26
|
+
source_code_uri: https://github.com/arnaudleroy-studio/mohitkhare-ruby
|
|
27
27
|
documentation_uri: https://mohitkhare.me/blog
|
|
28
|
-
bug_tracker_uri: https://github.com/
|
|
28
|
+
bug_tracker_uri: https://github.com/arnaudleroy-studio/mohitkhare-ruby/issues
|
|
29
29
|
post_install_message:
|
|
30
30
|
rdoc_options: []
|
|
31
31
|
require_paths:
|