string_expand 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/README.md +77 -26
- data/README2.md +39 -0
- data/lib/string_expand/version.rb +1 -1
- data/string_expand.gemspec +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51f39d25d6892e0b833d16834a5863eaec4673fa0bada5b611ec1d21bb685076
|
4
|
+
data.tar.gz: a85d82af60aec1f334eeacb72ad95f636e5dfcfc4210b23b6cfdd4710f8b5309
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ceed073c0b6cbb3e97c35c2376a4fda6b8a76621bf2ddfb4237a950c7b3b69430f51ae00aa79475bf321501fb82566ef650ac8e626761a342f27dfc59d884a1
|
7
|
+
data.tar.gz: ba2088300edec21e5874c11490f14372a9fd5bbba5ba35d4dec4f945758513d1adaa683a963a2e4a30a0821894b6cf676f96770bd8b6ccd2d56d57f543c7068b
|
data/README.md
CHANGED
@@ -1,39 +1,90 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
# [Service Nakama](https://rafayet-monon.github.io/service-nakama/)
|
2
|
+
[](https://badge.fury.io/rb/service-nakama)
|
3
|
+
[](https://travis-ci.org/rafayet-monon/service-nakama)
|
4
|
+
[](https://codeclimate.com/github/rafayet-monon/service-nakama/maintainability)
|
5
|
+
[](https://codecov.io/gh/rafayet-monon/service-nakama)
|
6
6
|
|
7
|
+
This is a tiny gem that provides some basic functionality to String Objects.
|
7
8
|
## Installation
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
Install the gem and add to the application's Gemfile by executing:
|
12
|
-
|
13
|
-
$ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
|
14
|
-
|
15
|
-
If bundler is not being used to manage dependencies, install the gem by executing:
|
10
|
+
Add this line to your application's Gemfile:
|
16
11
|
|
17
|
-
|
12
|
+
```ruby
|
13
|
+
gem 'service-nakama'
|
14
|
+
```
|
18
15
|
|
19
|
-
|
16
|
+
And then execute:
|
20
17
|
|
21
|
-
|
18
|
+
$ bundle install
|
22
19
|
|
23
|
-
|
20
|
+
Or install it yourself as:
|
24
21
|
|
25
|
-
|
22
|
+
$ gem install service-nakama
|
26
23
|
|
27
|
-
|
24
|
+
## Usage
|
28
25
|
|
26
|
+
To use this gem's functionality, just include the `ServiceNakama` module in your class.
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
class ReportService
|
30
|
+
include ServiceNakama
|
31
|
+
end
|
32
|
+
```
|
33
|
+
By default it expects the class to have a instance method named `perform`. This can be changed if needed. This method
|
34
|
+
like the main method of the class that will be called when using the service.
|
35
|
+
```ruby
|
36
|
+
report = ReportService.perform(some_parameter)
|
37
|
+
```
|
38
|
+
Using `ServiceNakama` will add two attribute reader to the class. One is `result` and the other one is `error`.
|
39
|
+
|
40
|
+
Whatever that is returned from the `perform` method will be considered as the result of the class.
|
41
|
+
```ruby
|
42
|
+
report.result
|
43
|
+
```
|
44
|
+
The error will be in the `error` property of the object.
|
45
|
+
```ruby
|
46
|
+
report.error
|
47
|
+
```
|
48
|
+
It also provides som other handy methods -
|
49
|
+
```ruby
|
50
|
+
report.success? # true or false
|
51
|
+
report.failed? # true or false
|
52
|
+
report.error_message # only error message
|
53
|
+
report.error_class # only error class
|
54
|
+
```
|
55
|
+
Also someone might want to log the error or use some exception tracking service for the errors that occured. To do
|
56
|
+
this just have override a instance method `error_logger`
|
57
|
+
```ruby
|
58
|
+
def error_logger
|
59
|
+
Rollbar.error(@error)
|
60
|
+
end
|
61
|
+
```
|
62
|
+
If you want something other than `perform` then you do the following -
|
63
|
+
```ruby
|
64
|
+
class ReportService
|
65
|
+
include ServiceNakama
|
66
|
+
main_method :call
|
67
|
+
end
|
68
|
+
```
|
69
|
+
Then it will expect the instance method `call` in that class and can be used like below -
|
70
|
+
```ruby
|
71
|
+
report = ReportService.call(some_parameter)
|
72
|
+
```
|
73
|
+
|
74
|
+
|
75
|
+
## Benchmarking
|
76
|
+
[Benchmarking](https://github.com/rafayet-monon/google-search-extractor/blob/benchmark/service_nakam/app/services/benchmark_nakama.rb) was done using a `ReportService` class for this
|
77
|
+
class [without service-nakama](https://github.com/rafayet-monon/google-search-extractor/blob/benchmark/service_nakam/app/services/report_service.rb)
|
78
|
+
& [with service-nakama](https://github.com/rafayet-monon/google-search-extractor/blob/benchmark/service_nakam/app/services/report_service_with_nakama.rb).
|
79
|
+
There is no performance issue that can done by this gem.
|
80
|
+
```
|
81
|
+
| user | | system | | total | | real |
|
82
|
+
-----------------------------------------------------------------------------------
|
83
|
+
Without ServiceNakama |5.702399| |0.017627| | 5.720026 | | (5.734128) |
|
84
|
+
-----------------------------------------------------------------------------------
|
85
|
+
With ServiceNakama |5.702157| |0.007777| | 5.709934 | | (5.720078) |
|
86
|
+
```
|
29
87
|
## Contributing
|
30
88
|
|
31
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
32
|
-
|
33
|
-
## License
|
34
|
-
|
35
|
-
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
36
|
-
|
37
|
-
## Code of Conduct
|
89
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/rafayet-monon/service-nakama.
|
38
90
|
|
39
|
-
Everyone interacting in the StringExpand project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/string_expand/blob/main/CODE_OF_CONDUCT.md).
|
data/README2.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# StringExpand
|
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_expand`. To experiment with that code, run `bin/console` for an interactive prompt.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_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
|
+
$ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
|
14
|
+
|
15
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
16
|
+
|
17
|
+
$ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Development
|
24
|
+
|
25
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
26
|
+
|
27
|
+
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).
|
28
|
+
|
29
|
+
## Contributing
|
30
|
+
|
31
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/string_expand. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/string_expand/blob/main/CODE_OF_CONDUCT.md).
|
32
|
+
|
33
|
+
## License
|
34
|
+
|
35
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
36
|
+
|
37
|
+
## Code of Conduct
|
38
|
+
|
39
|
+
Everyone interacting in the StringExpand project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/string_expand/blob/main/CODE_OF_CONDUCT.md).
|
data/string_expand.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.email = ["nafissazid48@gmail.com"]
|
10
10
|
|
11
11
|
spec.summary = "Parses index positions from string"
|
12
|
-
spec.description = "
|
12
|
+
spec.description = "It is a simple ruby gem that adds some useful features to the String class like parsing index positions from string."
|
13
13
|
# spec.homepage = "TODO: Put your gem's website or public repo URL here."
|
14
14
|
spec.license = "MIT"
|
15
15
|
spec.required_ruby_version = ">= 2.6.0"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: string_expand
|
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
|
- Nafis Sazid
|
@@ -10,7 +10,8 @@ bindir: exe
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2025-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
13
|
+
description: It is a simple ruby gem that adds some useful features to the String
|
14
|
+
class like parsing index positions from string.
|
14
15
|
email:
|
15
16
|
- nafissazid48@gmail.com
|
16
17
|
executables: []
|
@@ -24,6 +25,7 @@ files:
|
|
24
25
|
- Gemfile
|
25
26
|
- LICENSE.txt
|
26
27
|
- README.md
|
28
|
+
- README2.md
|
27
29
|
- Rakefile
|
28
30
|
- lib/string_expand.rb
|
29
31
|
- lib/string_expand/version.rb
|