others 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.0pdd.yml +25 -0
- data/.gitattributes +7 -0
- data/.github/workflows/actionlint.yml +41 -0
- data/.github/workflows/codecov.yml +39 -0
- data/.github/workflows/copyrights.yml +30 -0
- data/.github/workflows/markdown-lint.yml +38 -0
- data/.github/workflows/pdd.yml +34 -0
- data/.github/workflows/rake.yml +44 -0
- data/.github/workflows/xcop.yml +30 -0
- data/.github/workflows/yamllint.yml +36 -0
- data/.gitignore +8 -0
- data/.pdd +7 -0
- data/.rubocop.yml +52 -0
- data/.rultor.yml +42 -0
- data/.simplecov +41 -0
- data/.yamllint.yml +24 -0
- data/Gemfile +34 -0
- data/Gemfile.lock +180 -0
- data/LICENSE.txt +21 -0
- data/README.md +62 -0
- data/Rakefile +66 -0
- data/lib/others.rb +56 -0
- data/others.gemspec +45 -0
- data/renovate.json +6 -0
- data/test/test__helper.rb +31 -0
- data/test/test_others.rb +53 -0
- metadata +76 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 51ad48737df6d72aa97a373e215129281d16ffd15a9d06b1250c0c5eafe7363d
|
4
|
+
data.tar.gz: e62287a2f22a7a4840e5b97de44da4e3d27b1e911f2e5ef3ae8025c53e3f995a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6ea51ec72f96c046587e4d44ef6aef4b7a1900f8b25718a5a53f4be3e1f21094788a11e95ec415a3ea75717e25017c5af9afb3754d4207e4c54d7ef1b1a01c5d
|
7
|
+
data.tar.gz: d50ed164b2c75b0c0966adc3f3fc471450c04297e6b2f232f40a50b2dc21a2673535f5e921de5d7734df0b02edf49698d1642e2f1eed1b25b6813f8412063fcc
|
data/.0pdd.yml
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# Copyright (c) 2024 Yegor Bugayenko
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in all
|
11
|
+
# copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
# SOFTWARE.
|
20
|
+
---
|
21
|
+
errors:
|
22
|
+
- yegor256@gmail.com
|
23
|
+
# alerts:
|
24
|
+
# github:
|
25
|
+
# - yegor256
|
data/.gitattributes
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# Copyright (c) 2024 Yegor Bugayenko
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in all
|
11
|
+
# copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
# SOFTWARE.
|
20
|
+
---
|
21
|
+
name: actionlint
|
22
|
+
'on':
|
23
|
+
push:
|
24
|
+
branches:
|
25
|
+
- master
|
26
|
+
pull_request:
|
27
|
+
branches:
|
28
|
+
- master
|
29
|
+
jobs:
|
30
|
+
actionlint:
|
31
|
+
runs-on: ubuntu-22.04
|
32
|
+
steps:
|
33
|
+
- uses: actions/checkout@v4
|
34
|
+
- name: Download actionlint
|
35
|
+
id: get_actionlint
|
36
|
+
# yamllint disable-line rule:line-length
|
37
|
+
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
|
38
|
+
shell: bash
|
39
|
+
- name: Check workflow files
|
40
|
+
run: ${{ steps.get_actionlint.outputs.executable }} -color
|
41
|
+
shell: bash
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# Copyright (c) 2024 Yegor Bugayenko
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in all
|
11
|
+
# copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
# SOFTWARE.
|
20
|
+
---
|
21
|
+
name: codecov
|
22
|
+
'on':
|
23
|
+
push:
|
24
|
+
branches:
|
25
|
+
- master
|
26
|
+
jobs:
|
27
|
+
codecov:
|
28
|
+
runs-on: ubuntu-22.04
|
29
|
+
steps:
|
30
|
+
- uses: actions/checkout@v4
|
31
|
+
- uses: ruby/setup-ruby@v1
|
32
|
+
with:
|
33
|
+
ruby-version: 3.2
|
34
|
+
bundler-cache: true
|
35
|
+
- run: bundle install
|
36
|
+
- run: bundle exec rake
|
37
|
+
- uses: codecov/codecov-action@v4.0.0-beta.3
|
38
|
+
with:
|
39
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# Copyright (c) 2024 Yegor Bugayenko
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in all
|
11
|
+
# copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
# SOFTWARE.
|
20
|
+
---
|
21
|
+
name: copyrights
|
22
|
+
'on':
|
23
|
+
push:
|
24
|
+
pull_request:
|
25
|
+
jobs:
|
26
|
+
copyrights:
|
27
|
+
runs-on: ubuntu-22.04
|
28
|
+
steps:
|
29
|
+
- uses: actions/checkout@v4
|
30
|
+
- uses: yegor256/copyrights-action@0.0.4
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# Copyright (c) 2024 Yegor Bugayenko
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in all
|
11
|
+
# copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
# SOFTWARE.
|
20
|
+
---
|
21
|
+
name: markdown-lint
|
22
|
+
'on':
|
23
|
+
push:
|
24
|
+
branches:
|
25
|
+
- master
|
26
|
+
pull_request:
|
27
|
+
branches:
|
28
|
+
- master
|
29
|
+
paths-ignore: ['paper/**', 'sandbox/**']
|
30
|
+
concurrency:
|
31
|
+
group: markdown-lint-${{ github.ref }}
|
32
|
+
cancel-in-progress: true
|
33
|
+
jobs:
|
34
|
+
markdown-lint:
|
35
|
+
runs-on: ubuntu-22.04
|
36
|
+
steps:
|
37
|
+
- uses: actions/checkout@v4
|
38
|
+
- uses: articulate/actions-markdownlint@v1
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# Copyright (c) 2024 Yegor Bugayenko
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in all
|
11
|
+
# copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
# SOFTWARE.
|
20
|
+
---
|
21
|
+
name: pdd
|
22
|
+
'on':
|
23
|
+
push:
|
24
|
+
branches:
|
25
|
+
- master
|
26
|
+
pull_request:
|
27
|
+
branches:
|
28
|
+
- master
|
29
|
+
jobs:
|
30
|
+
pdd:
|
31
|
+
runs-on: ubuntu-22.04
|
32
|
+
steps:
|
33
|
+
- uses: actions/checkout@v4
|
34
|
+
- uses: volodya-lombrozo/pdd-action@master
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# Copyright (c) 2024 Yegor Bugayenko
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in all
|
11
|
+
# copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
# SOFTWARE.
|
20
|
+
---
|
21
|
+
name: rake
|
22
|
+
'on':
|
23
|
+
push:
|
24
|
+
branches:
|
25
|
+
- master
|
26
|
+
pull_request:
|
27
|
+
branches:
|
28
|
+
- master
|
29
|
+
jobs:
|
30
|
+
rake:
|
31
|
+
name: test
|
32
|
+
strategy:
|
33
|
+
matrix:
|
34
|
+
os: [ubuntu-20.04, macos-12, windows-2022]
|
35
|
+
ruby: [3.2]
|
36
|
+
runs-on: ${{ matrix.os }}
|
37
|
+
steps:
|
38
|
+
- uses: actions/checkout@v4
|
39
|
+
- uses: ruby/setup-ruby@v1
|
40
|
+
with:
|
41
|
+
ruby-version: ${{ matrix.ruby }}
|
42
|
+
bundler-cache: true
|
43
|
+
- run: bundle install
|
44
|
+
- run: bundle exec rake
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# Copyright (c) 2024 Yegor Bugayenko
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in all
|
11
|
+
# copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
# SOFTWARE.
|
20
|
+
---
|
21
|
+
name: xcop
|
22
|
+
'on':
|
23
|
+
push:
|
24
|
+
pull_request:
|
25
|
+
jobs:
|
26
|
+
xcop:
|
27
|
+
runs-on: ubuntu-22.04
|
28
|
+
steps:
|
29
|
+
- uses: actions/checkout@v4
|
30
|
+
- uses: g4s8/xcop-action@master
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# Copyright (c) 2024 Yegor Bugayenko
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in all
|
11
|
+
# copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
# SOFTWARE.
|
20
|
+
---
|
21
|
+
name: yamllint
|
22
|
+
'on':
|
23
|
+
push:
|
24
|
+
branches:
|
25
|
+
- master
|
26
|
+
pull_request:
|
27
|
+
branches:
|
28
|
+
- master
|
29
|
+
jobs:
|
30
|
+
yamllint:
|
31
|
+
runs-on: ubuntu-22.04
|
32
|
+
steps:
|
33
|
+
- uses: actions/checkout@v4
|
34
|
+
- uses: ibiqlik/action-yamllint@v3
|
35
|
+
with:
|
36
|
+
config_file: .yamllint.yml
|
data/.gitignore
ADDED
data/.pdd
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# Copyright (c) 2024 Yegor Bugayenko
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in all
|
11
|
+
# copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
# SOFTWARE.
|
20
|
+
---
|
21
|
+
AllCops:
|
22
|
+
Exclude:
|
23
|
+
- 'bin/**/*'
|
24
|
+
- 'assets/**/*'
|
25
|
+
- 'vendor/**/**'
|
26
|
+
DisplayCopNames: true
|
27
|
+
TargetRubyVersion: 3.2
|
28
|
+
SuggestExtensions: false
|
29
|
+
NewCops: enable
|
30
|
+
|
31
|
+
Style/OptionalBooleanParameter:
|
32
|
+
Enabled: false
|
33
|
+
Lint/NestedMethodDefinition:
|
34
|
+
Enabled: false
|
35
|
+
Gemspec/RequiredRubyVersion:
|
36
|
+
Enabled: false
|
37
|
+
Metrics/MethodLength:
|
38
|
+
Enabled: false
|
39
|
+
Metrics/AbcSize:
|
40
|
+
Enabled: false
|
41
|
+
Metrics/BlockLength:
|
42
|
+
Enabled: false
|
43
|
+
Metrics/CyclomaticComplexity:
|
44
|
+
Enabled: false
|
45
|
+
Metrics/PerceivedComplexity:
|
46
|
+
Enabled: false
|
47
|
+
Metrics/ClassLength:
|
48
|
+
Enabled: false
|
49
|
+
Layout/EmptyLineAfterGuardClause:
|
50
|
+
Enabled: false
|
51
|
+
Layout/EndOfLine:
|
52
|
+
EnforcedStyle: lf
|
data/.rultor.yml
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# Copyright (c) 2024 Yegor Bugayenko
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in all
|
11
|
+
# copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
# SOFTWARE.
|
20
|
+
---
|
21
|
+
docker:
|
22
|
+
image: yegor256/rultor-image:1.23.1
|
23
|
+
assets:
|
24
|
+
rubygems.yml: yegor256/home#assets/rubygems.yml
|
25
|
+
install: |
|
26
|
+
pdd -f /dev/null
|
27
|
+
bundle install --no-color
|
28
|
+
release:
|
29
|
+
pre: false
|
30
|
+
script: |-
|
31
|
+
[[ "${tag}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || exit -1
|
32
|
+
bundle exec rake
|
33
|
+
rm -rf *.gem
|
34
|
+
sed -i "s/0\.0\.0/${tag}/g" others.gemspec
|
35
|
+
git add others.gemspec
|
36
|
+
git commit -m "version set to ${tag}"
|
37
|
+
gem build others.gemspec
|
38
|
+
chmod 0600 ../rubygems.yml
|
39
|
+
gem push *.gem --config-file ../rubygems.yml
|
40
|
+
merge:
|
41
|
+
script: |-
|
42
|
+
bundle exec rake
|
data/.simplecov
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#
|
4
|
+
# Copyright (c) 2024 Yegor Bugayenko
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in all
|
14
|
+
# copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
# SOFTWARE.
|
23
|
+
|
24
|
+
if Gem.win_platform?
|
25
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
26
|
+
SimpleCov::Formatter::HTMLFormatter
|
27
|
+
]
|
28
|
+
SimpleCov.start do
|
29
|
+
add_filter '/test/'
|
30
|
+
add_filter '/features/'
|
31
|
+
end
|
32
|
+
else
|
33
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
|
34
|
+
[SimpleCov::Formatter::HTMLFormatter]
|
35
|
+
)
|
36
|
+
SimpleCov.start do
|
37
|
+
add_filter '/test/'
|
38
|
+
add_filter '/features/'
|
39
|
+
minimum_coverage 20
|
40
|
+
end
|
41
|
+
end
|
data/.yamllint.yml
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# Copyright (c) 2024 Yegor Bugayenko
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in all
|
11
|
+
# copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
# SOFTWARE.
|
20
|
+
---
|
21
|
+
rules:
|
22
|
+
line-length:
|
23
|
+
max: 80
|
24
|
+
allow-non-breakable-words: true
|
data/Gemfile
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright (c) 2024 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
source 'https://rubygems.org'
|
24
|
+
gemspec
|
25
|
+
|
26
|
+
gem 'minitest', '5.24.0', require: false
|
27
|
+
gem 'rake', '13.2.1', require: false
|
28
|
+
gem 'rspec-rails', '6.1.3', require: false
|
29
|
+
gem 'rubocop', '1.64.1', require: false
|
30
|
+
gem 'rubocop-performance', '1.21.1', require: false
|
31
|
+
gem 'rubocop-rspec', '3.0.1', require: false
|
32
|
+
gem 'simplecov', '0.22.0', require: false
|
33
|
+
gem 'simplecov-cobertura', '2.1.0', require: false
|
34
|
+
gem 'yard', '0.9.36', require: false
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,180 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
others (0.0.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
actionpack (7.1.3.4)
|
10
|
+
actionview (= 7.1.3.4)
|
11
|
+
activesupport (= 7.1.3.4)
|
12
|
+
nokogiri (>= 1.8.5)
|
13
|
+
racc
|
14
|
+
rack (>= 2.2.4)
|
15
|
+
rack-session (>= 1.0.1)
|
16
|
+
rack-test (>= 0.6.3)
|
17
|
+
rails-dom-testing (~> 2.2)
|
18
|
+
rails-html-sanitizer (~> 1.6)
|
19
|
+
actionview (7.1.3.4)
|
20
|
+
activesupport (= 7.1.3.4)
|
21
|
+
builder (~> 3.1)
|
22
|
+
erubi (~> 1.11)
|
23
|
+
rails-dom-testing (~> 2.2)
|
24
|
+
rails-html-sanitizer (~> 1.6)
|
25
|
+
activesupport (7.1.3.4)
|
26
|
+
base64
|
27
|
+
bigdecimal
|
28
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
29
|
+
connection_pool (>= 2.2.5)
|
30
|
+
drb
|
31
|
+
i18n (>= 1.6, < 2)
|
32
|
+
minitest (>= 5.1)
|
33
|
+
mutex_m
|
34
|
+
tzinfo (~> 2.0)
|
35
|
+
ast (2.4.2)
|
36
|
+
base64 (0.2.0)
|
37
|
+
bigdecimal (3.1.8)
|
38
|
+
builder (3.3.0)
|
39
|
+
concurrent-ruby (1.3.3)
|
40
|
+
connection_pool (2.4.1)
|
41
|
+
crass (1.0.6)
|
42
|
+
diff-lcs (1.5.1)
|
43
|
+
docile (1.4.0)
|
44
|
+
drb (2.2.1)
|
45
|
+
erubi (1.13.0)
|
46
|
+
i18n (1.14.5)
|
47
|
+
concurrent-ruby (~> 1.0)
|
48
|
+
io-console (0.7.2)
|
49
|
+
irb (1.13.2)
|
50
|
+
rdoc (>= 4.0.0)
|
51
|
+
reline (>= 0.4.2)
|
52
|
+
json (2.7.2)
|
53
|
+
language_server-protocol (3.17.0.3)
|
54
|
+
loofah (2.22.0)
|
55
|
+
crass (~> 1.0.2)
|
56
|
+
nokogiri (>= 1.12.0)
|
57
|
+
minitest (5.24.0)
|
58
|
+
mutex_m (0.2.0)
|
59
|
+
nokogiri (1.16.6-arm64-darwin)
|
60
|
+
racc (~> 1.4)
|
61
|
+
nokogiri (1.16.6-x64-mingw-ucrt)
|
62
|
+
racc (~> 1.4)
|
63
|
+
nokogiri (1.16.6-x86_64-darwin)
|
64
|
+
racc (~> 1.4)
|
65
|
+
nokogiri (1.16.6-x86_64-linux)
|
66
|
+
racc (~> 1.4)
|
67
|
+
parallel (1.25.1)
|
68
|
+
parser (3.3.3.0)
|
69
|
+
ast (~> 2.4.1)
|
70
|
+
racc
|
71
|
+
psych (5.1.2)
|
72
|
+
stringio
|
73
|
+
racc (1.8.0)
|
74
|
+
rack (3.1.4)
|
75
|
+
rack-session (2.0.0)
|
76
|
+
rack (>= 3.0.0)
|
77
|
+
rack-test (2.1.0)
|
78
|
+
rack (>= 1.3)
|
79
|
+
rackup (2.1.0)
|
80
|
+
rack (>= 3)
|
81
|
+
webrick (~> 1.8)
|
82
|
+
rails-dom-testing (2.2.0)
|
83
|
+
activesupport (>= 5.0.0)
|
84
|
+
minitest
|
85
|
+
nokogiri (>= 1.6)
|
86
|
+
rails-html-sanitizer (1.6.0)
|
87
|
+
loofah (~> 2.21)
|
88
|
+
nokogiri (~> 1.14)
|
89
|
+
railties (7.1.3.4)
|
90
|
+
actionpack (= 7.1.3.4)
|
91
|
+
activesupport (= 7.1.3.4)
|
92
|
+
irb
|
93
|
+
rackup (>= 1.0.0)
|
94
|
+
rake (>= 12.2)
|
95
|
+
thor (~> 1.0, >= 1.2.2)
|
96
|
+
zeitwerk (~> 2.6)
|
97
|
+
rainbow (3.1.1)
|
98
|
+
rake (13.2.1)
|
99
|
+
rdoc (6.7.0)
|
100
|
+
psych (>= 4.0.0)
|
101
|
+
regexp_parser (2.9.2)
|
102
|
+
reline (0.5.9)
|
103
|
+
io-console (~> 0.5)
|
104
|
+
rexml (3.3.0)
|
105
|
+
strscan
|
106
|
+
rspec-core (3.13.0)
|
107
|
+
rspec-support (~> 3.13.0)
|
108
|
+
rspec-expectations (3.13.1)
|
109
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
110
|
+
rspec-support (~> 3.13.0)
|
111
|
+
rspec-mocks (3.13.1)
|
112
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
113
|
+
rspec-support (~> 3.13.0)
|
114
|
+
rspec-rails (6.1.3)
|
115
|
+
actionpack (>= 6.1)
|
116
|
+
activesupport (>= 6.1)
|
117
|
+
railties (>= 6.1)
|
118
|
+
rspec-core (~> 3.13)
|
119
|
+
rspec-expectations (~> 3.13)
|
120
|
+
rspec-mocks (~> 3.13)
|
121
|
+
rspec-support (~> 3.13)
|
122
|
+
rspec-support (3.13.1)
|
123
|
+
rubocop (1.64.1)
|
124
|
+
json (~> 2.3)
|
125
|
+
language_server-protocol (>= 3.17.0)
|
126
|
+
parallel (~> 1.10)
|
127
|
+
parser (>= 3.3.0.2)
|
128
|
+
rainbow (>= 2.2.2, < 4.0)
|
129
|
+
regexp_parser (>= 1.8, < 3.0)
|
130
|
+
rexml (>= 3.2.5, < 4.0)
|
131
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
132
|
+
ruby-progressbar (~> 1.7)
|
133
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
134
|
+
rubocop-ast (1.31.3)
|
135
|
+
parser (>= 3.3.1.0)
|
136
|
+
rubocop-performance (1.21.1)
|
137
|
+
rubocop (>= 1.48.1, < 2.0)
|
138
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
139
|
+
rubocop-rspec (3.0.1)
|
140
|
+
rubocop (~> 1.61)
|
141
|
+
ruby-progressbar (1.13.0)
|
142
|
+
simplecov (0.22.0)
|
143
|
+
docile (~> 1.1)
|
144
|
+
simplecov-html (~> 0.11)
|
145
|
+
simplecov_json_formatter (~> 0.1)
|
146
|
+
simplecov-cobertura (2.1.0)
|
147
|
+
rexml
|
148
|
+
simplecov (~> 0.19)
|
149
|
+
simplecov-html (0.12.3)
|
150
|
+
simplecov_json_formatter (0.1.4)
|
151
|
+
stringio (3.1.1)
|
152
|
+
strscan (3.1.0)
|
153
|
+
thor (1.3.1)
|
154
|
+
tzinfo (2.0.6)
|
155
|
+
concurrent-ruby (~> 1.0)
|
156
|
+
unicode-display_width (2.5.0)
|
157
|
+
webrick (1.8.1)
|
158
|
+
yard (0.9.36)
|
159
|
+
zeitwerk (2.6.16)
|
160
|
+
|
161
|
+
PLATFORMS
|
162
|
+
arm64-darwin-22
|
163
|
+
x64-mingw-ucrt
|
164
|
+
x86_64-darwin-20
|
165
|
+
x86_64-linux
|
166
|
+
|
167
|
+
DEPENDENCIES
|
168
|
+
minitest (= 5.24.0)
|
169
|
+
others!
|
170
|
+
rake (= 13.2.1)
|
171
|
+
rspec-rails (= 6.1.3)
|
172
|
+
rubocop (= 1.64.1)
|
173
|
+
rubocop-performance (= 1.21.1)
|
174
|
+
rubocop-rspec (= 3.0.1)
|
175
|
+
simplecov (= 0.22.0)
|
176
|
+
simplecov-cobertura (= 2.1.0)
|
177
|
+
yard (= 0.9.36)
|
178
|
+
|
179
|
+
BUNDLED WITH
|
180
|
+
2.4.22
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
(The MIT License)
|
2
|
+
|
3
|
+
Copyright (c) 2024 Yegor Bugayenko
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
# True Object-Oriented Decorator
|
2
|
+
|
3
|
+
[![DevOps By Rultor.com](http://www.rultor.com/b/yegor256/others)](http://www.rultor.com/p/yegor256/others)
|
4
|
+
[![We recommend RubyMine](https://www.elegantobjects.org/rubymine.svg)](https://www.jetbrains.com/ruby/)
|
5
|
+
|
6
|
+
[![rake](https://github.com/yegor256/others/actions/workflows/rake.yml/badge.svg)](https://github.com/yegor256/others/actions/workflows/rake.yml)
|
7
|
+
[![PDD status](http://www.0pdd.com/svg?name=yegor256/others)](http://www.0pdd.com/p?name=yegor256/others)
|
8
|
+
[![Gem Version](https://badge.fury.io/rb/others.svg)](http://badge.fury.io/rb/others)
|
9
|
+
[![Test Coverage](https://img.shields.io/codecov/c/github/yegor256/others.svg)](https://codecov.io/github/yegor256/others?branch=master)
|
10
|
+
[![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](http://rubydoc.info/github/yegor256/others/master/frames)
|
11
|
+
[![Hits-of-Code](https://hitsofcode.com/github/yegor256/others)](https://hitsofcode.com/view/github/yegor256/others)
|
12
|
+
[![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/yegor256/others/blob/master/LICENSE.txt)
|
13
|
+
|
14
|
+
Let's say, you have an object that you want to decorate, thus
|
15
|
+
adding new attributes and methods to it. Here is how:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
require 'others'
|
19
|
+
s = ' Jeff Lebowski '
|
20
|
+
d = others(s, br: ' ') do
|
21
|
+
def parts
|
22
|
+
@origin.strip.split(@br)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
assert(d.parts == ['Jeff', 'Lebowski'])
|
26
|
+
```
|
27
|
+
|
28
|
+
You may also turn an existing class into a decorator:
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
require 'others'
|
32
|
+
class MyString
|
33
|
+
def initialize(s, br)
|
34
|
+
@s = s
|
35
|
+
@br = br
|
36
|
+
end
|
37
|
+
others(:s)
|
38
|
+
def parts
|
39
|
+
@origin.strip.split(@br)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
d = MyString.new('Jeff Lebowski')
|
43
|
+
assert(d.parts == ['Jeff', 'Lebowski'])
|
44
|
+
```
|
45
|
+
|
46
|
+
That's it.
|
47
|
+
|
48
|
+
## How to contribute
|
49
|
+
|
50
|
+
Read
|
51
|
+
[these guidelines](https://www.yegor256.com/2014/04/15/github-guidelines.html).
|
52
|
+
Make sure you build is green before you contribute
|
53
|
+
your pull request. You will need to have
|
54
|
+
[Ruby](https://www.ruby-lang.org/en/) 3.2+ and
|
55
|
+
[Bundler](https://bundler.io/) installed. Then:
|
56
|
+
|
57
|
+
```bash
|
58
|
+
bundle update
|
59
|
+
bundle exec rake
|
60
|
+
```
|
61
|
+
|
62
|
+
If it's clean and you don't see any error messages, submit your pull request.
|
data/Rakefile
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright (c) 2024 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
require 'rubygems'
|
24
|
+
require 'rake'
|
25
|
+
require 'rake/clean'
|
26
|
+
|
27
|
+
def name
|
28
|
+
@name ||= File.basename(Dir['*.gemspec'].first, '.*')
|
29
|
+
end
|
30
|
+
|
31
|
+
def version
|
32
|
+
Gem::Specification.load(Dir['*.gemspec'].first).version
|
33
|
+
end
|
34
|
+
|
35
|
+
task default: %i[clean test rubocop yard copyright]
|
36
|
+
|
37
|
+
require 'rake/testtask'
|
38
|
+
desc 'Run all unit tests'
|
39
|
+
Rake::TestTask.new(:test) do |test|
|
40
|
+
Rake::Cleaner.cleanup_files(['coverage'])
|
41
|
+
test.libs << 'lib' << 'test'
|
42
|
+
test.pattern = 'test/**/test_*.rb'
|
43
|
+
test.warning = true
|
44
|
+
test.verbose = false
|
45
|
+
end
|
46
|
+
|
47
|
+
require 'yard'
|
48
|
+
desc 'Build Yard documentation'
|
49
|
+
YARD::Rake::YardocTask.new do |t|
|
50
|
+
t.files = ['lib/**/*.rb']
|
51
|
+
end
|
52
|
+
|
53
|
+
require 'rubocop/rake_task'
|
54
|
+
desc 'Run RuboCop on all directories'
|
55
|
+
RuboCop::RakeTask.new(:rubocop) do |task|
|
56
|
+
task.fail_on_error = true
|
57
|
+
task.requires << 'rubocop-rspec'
|
58
|
+
end
|
59
|
+
|
60
|
+
task :copyright do
|
61
|
+
sh "grep -q -r '#{Date.today.strftime('%Y')}' \
|
62
|
+
--include '*.rb' \
|
63
|
+
--include '*.txt' \
|
64
|
+
--include 'Rakefile' \
|
65
|
+
."
|
66
|
+
end
|
data/lib/others.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright (c) 2024 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
# A function that catches all undeclared methods.
|
24
|
+
#
|
25
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
26
|
+
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
|
27
|
+
# License:: MIT
|
28
|
+
def others(attrs = {}, &block)
|
29
|
+
raise 'A block is expected' unless block_given?
|
30
|
+
c = Class.new do
|
31
|
+
def initialize(attrs, &block)
|
32
|
+
# rubocop:disable Style/HashEachMethods
|
33
|
+
# rubocop:disable Lint/UnusedBlockArgument
|
34
|
+
attrs.each do |k, v|
|
35
|
+
instance_eval("@#{k} = v", __FILE__, __LINE__) # @foo = v
|
36
|
+
end
|
37
|
+
# rubocop:enable Style/HashEachMethods
|
38
|
+
# rubocop:enable Lint/UnusedBlockArgument
|
39
|
+
@block = block
|
40
|
+
end
|
41
|
+
|
42
|
+
def method_missing(*args)
|
43
|
+
raise 'Block cannot be provided' if block_given?
|
44
|
+
instance_exec(*args, &@block)
|
45
|
+
end
|
46
|
+
|
47
|
+
def respond_to?(_mtd, _inc = false)
|
48
|
+
true
|
49
|
+
end
|
50
|
+
|
51
|
+
def respond_to_missing?(_mtd, _inc = false)
|
52
|
+
true
|
53
|
+
end
|
54
|
+
end
|
55
|
+
c.new(attrs, &block)
|
56
|
+
end
|
data/others.gemspec
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright (c) 2024 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
require 'English'
|
24
|
+
require_relative 'lib/others'
|
25
|
+
|
26
|
+
Gem::Specification.new do |s|
|
27
|
+
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
|
28
|
+
s.required_ruby_version = '>=3.0'
|
29
|
+
s.name = 'others'
|
30
|
+
s.version = '0.0.1'
|
31
|
+
s.license = 'MIT'
|
32
|
+
s.summary = 'others'
|
33
|
+
s.description =
|
34
|
+
'A primitive gem that helps you decorate an object or turn an existing
|
35
|
+
class into a decorator. The key difference between this gem and a thousand
|
36
|
+
other gems that are doing almost the same is that this gem is really
|
37
|
+
object-oriented.'
|
38
|
+
s.authors = ['Yegor Bugayenko']
|
39
|
+
s.email = 'yegor256@gmail.com'
|
40
|
+
s.homepage = 'http://github.com/yegor256/others.rb'
|
41
|
+
s.files = `git ls-files`.split($RS)
|
42
|
+
s.rdoc_options = ['--charset=UTF-8']
|
43
|
+
s.extra_rdoc_files = ['README.md', 'LICENSE.txt']
|
44
|
+
s.metadata['rubygems_mfa_required'] = 'true'
|
45
|
+
end
|
data/renovate.json
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright (c) 2024 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
$stdout.sync = true
|
24
|
+
|
25
|
+
require 'simplecov'
|
26
|
+
SimpleCov.start
|
27
|
+
|
28
|
+
require 'simplecov-cobertura'
|
29
|
+
SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter
|
30
|
+
|
31
|
+
require 'minitest/autorun'
|
data/test/test_others.rb
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright (c) 2024 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
require 'minitest/autorun'
|
24
|
+
require_relative '../lib/others'
|
25
|
+
|
26
|
+
# Others main module test.
|
27
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
28
|
+
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
|
29
|
+
# License:: MIT
|
30
|
+
class TestOthers < Minitest::Test
|
31
|
+
def test_as_function
|
32
|
+
x = others(foo: 42) do
|
33
|
+
@foo + 1
|
34
|
+
end
|
35
|
+
assert_equal(43, x.bar)
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_as_function_with_args
|
39
|
+
x = others(foo: 42) do |*args|
|
40
|
+
@foo + args[1]
|
41
|
+
end
|
42
|
+
assert_equal(97, x.bar(55))
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_as_function_with_block
|
46
|
+
x = others(foo: 42) do
|
47
|
+
yield 42
|
48
|
+
end
|
49
|
+
assert_raises do
|
50
|
+
x.bar { |i| i + 1 }
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
metadata
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: others
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Yegor Bugayenko
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-06-24 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: |-
|
14
|
+
A primitive gem that helps you decorate an object or turn an existing
|
15
|
+
class into a decorator. The key difference between this gem and a thousand
|
16
|
+
other gems that are doing almost the same is that this gem is really
|
17
|
+
object-oriented.
|
18
|
+
email: yegor256@gmail.com
|
19
|
+
executables: []
|
20
|
+
extensions: []
|
21
|
+
extra_rdoc_files:
|
22
|
+
- README.md
|
23
|
+
- LICENSE.txt
|
24
|
+
files:
|
25
|
+
- ".0pdd.yml"
|
26
|
+
- ".gitattributes"
|
27
|
+
- ".github/workflows/actionlint.yml"
|
28
|
+
- ".github/workflows/codecov.yml"
|
29
|
+
- ".github/workflows/copyrights.yml"
|
30
|
+
- ".github/workflows/markdown-lint.yml"
|
31
|
+
- ".github/workflows/pdd.yml"
|
32
|
+
- ".github/workflows/rake.yml"
|
33
|
+
- ".github/workflows/xcop.yml"
|
34
|
+
- ".github/workflows/yamllint.yml"
|
35
|
+
- ".gitignore"
|
36
|
+
- ".pdd"
|
37
|
+
- ".rubocop.yml"
|
38
|
+
- ".rultor.yml"
|
39
|
+
- ".simplecov"
|
40
|
+
- ".yamllint.yml"
|
41
|
+
- Gemfile
|
42
|
+
- Gemfile.lock
|
43
|
+
- LICENSE.txt
|
44
|
+
- README.md
|
45
|
+
- Rakefile
|
46
|
+
- lib/others.rb
|
47
|
+
- others.gemspec
|
48
|
+
- renovate.json
|
49
|
+
- test/test__helper.rb
|
50
|
+
- test/test_others.rb
|
51
|
+
homepage: http://github.com/yegor256/others.rb
|
52
|
+
licenses:
|
53
|
+
- MIT
|
54
|
+
metadata:
|
55
|
+
rubygems_mfa_required: 'true'
|
56
|
+
post_install_message:
|
57
|
+
rdoc_options:
|
58
|
+
- "--charset=UTF-8"
|
59
|
+
require_paths:
|
60
|
+
- lib
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '3.0'
|
66
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
requirements: []
|
72
|
+
rubygems_version: 3.4.10
|
73
|
+
signing_key:
|
74
|
+
specification_version: 4
|
75
|
+
summary: others
|
76
|
+
test_files: []
|