string_utils_vantrong 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 4a3d703072117c19a28cdf1162df1aee6d5517f94a80451f73d93c4c29fc6e8c
4
+ data.tar.gz: a7ebb5b918e636dff1858750207537ecccbe656d1533c9d26315101a85e2c649
5
+ SHA512:
6
+ metadata.gz: 92b9c238284efcca33a8fe81ed63977431c13e95692fc4e988433d4664ec179515401155c676991dd243cf5f07f9097e43125ec164b4dcbb5a1b37f3af740e21
7
+ data.tar.gz: 8e882122c005b325b9d0a00732ad98d89857b2762251fd070505aa836002abbb25d7b0564ca1f9872f84d4252b26db17446f7326060a90d2f6047602c7209b80
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ *.gem
data/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # StringUtils
2
+
3
+ TODO: Delete this and the text below, and describe your gem
4
+
5
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/string_utils`. To experiment with that code, run `bin/console` for an interactive prompt.
6
+
7
+ ## Installation
8
+
9
+ TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
10
+
11
+ Install the gem and add to the application's Gemfile by executing:
12
+
13
+ ```bash
14
+ bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
15
+ ```
16
+
17
+ If bundler is not being used to manage dependencies, install the gem by executing:
18
+
19
+ ```bash
20
+ gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/string_utils.
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 'string_utils'
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
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module StringUtils
4
+ VERSION = '0.1.0'
5
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ # lib/string_utils.rb
4
+ require_relative 'string_utils/version'
5
+
6
+ module StringUtils
7
+ class Error < StandardError; end
8
+
9
+ # Chuyển đổi chuỗi thành dạng snake_case
10
+ def self.to_snake_case(str)
11
+ str.gsub(/::/, '/')
12
+ .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
13
+ .gsub(/([a-z\d])([A-Z])/, '\1_\2')
14
+ .tr('-', '_')
15
+ .downcase
16
+ end
17
+
18
+ # Chuyển đổi chuỗi thành dạng camelCase
19
+ def self.to_camel_case(str)
20
+ str.split('_').collect.with_index do |word, i|
21
+ i.zero? ? word : word.capitalize
22
+ end.join
23
+ end
24
+
25
+ # Đảo ngược chuỗi
26
+ def self.reverse(str)
27
+ str.reverse
28
+ end
29
+
30
+ # Đếm số từ trong chuỗi
31
+ def self.word_count(str)
32
+ str.split(/\s+/).length
33
+ end
34
+ end
@@ -0,0 +1,4 @@
1
+ module StringUtils
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,53 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: string_utils_vantrong
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Doan Vo Van Trong
8
+ bindir: exe
9
+ cert_chain: []
10
+ date: 2025-03-25 00:00:00.000000000 Z
11
+ dependencies: []
12
+ description: StringUtils provides powerful string manipulation helpers with support
13
+ for blocks, procs, and lambdas. Easy to extend for custom string processing.
14
+ email:
15
+ - trong.doan@tomosia.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".gitignore"
21
+ - README.md
22
+ - bin/console
23
+ - bin/setup
24
+ - lib/string_utils.rb
25
+ - lib/string_utils/version.rb
26
+ - sig/string_utils.rbs
27
+ homepage: https://github.com/vantrong24052003/training-ruby
28
+ licenses:
29
+ - MIT
30
+ metadata:
31
+ homepage_uri: https://github.com/vantrong24052003/training-ruby
32
+ source_code_uri: https://github.com/vantrong24052003/training-ruby
33
+ changelog_uri: https://github.com/vantrong24052003/training-ruby
34
+ rubygems_mfa_required: 'true'
35
+ allowed_push_host: https://rubygems.org
36
+ rdoc_options: []
37
+ require_paths:
38
+ - lib
39
+ required_ruby_version: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 3.1.0
44
+ required_rubygems_version: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ requirements: []
50
+ rubygems_version: 3.6.6
51
+ specification_version: 4
52
+ summary: Flexible string utilities with support for block, proc, and lambda
53
+ test_files: []