veils 0.3.0 → 0.4.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 +4 -4
- data/.github/workflows/codecov.yml +20 -0
- data/.github/workflows/pdd.yml +11 -0
- data/.github/workflows/rake.yml +24 -0
- data/.github/workflows/xcop.yml +11 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +6 -2
- data/.rultor.yml +3 -6
- data/Gemfile +8 -2
- data/README.md +2 -4
- data/Rakefile +1 -1
- data/lib/alterin.rb +4 -6
- data/lib/alterout.rb +4 -6
- data/lib/unpiercable.rb +4 -6
- data/lib/veil.rb +4 -6
- data/renovate.json +6 -0
- data/test/test__helper.rb +30 -0
- data/test/test_alterin.rb +16 -2
- data/test/test_alterout.rb +16 -2
- data/test/test_unpiercable.rb +16 -2
- data/test/test_veil.rb +16 -2
- data/veils.gemspec +4 -13
- metadata +14 -83
- data/.travis.yml +0 -12
- data/appveyor.yml +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f513329bb84443c3a8a723560a6632155e7a615e5600184ea35e2ac78d9a2cf
|
4
|
+
data.tar.gz: 99da05320c58895c4c2ea5b0a9475ae26436198cdcfa81a8f6d739a0aa52966e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3bf4e67e4d20f8d0dbd3357a0dac91efe30d73c336dd6ad7042b6a9ebb1591589b283df5974585ce206034dd91a8272729dd2e0462023a0b2fae65f22269e58e
|
7
|
+
data.tar.gz: 0fe108e9065d2854139b1d63801b186e361f91d182f4343e98804d4edd9b15801c101db569eecc69e87a3a3f7d76b293586a7588f0e117aa827ed53506dd49bb
|
@@ -0,0 +1,20 @@
|
|
1
|
+
---
|
2
|
+
name: codecov
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
jobs:
|
8
|
+
codecov:
|
9
|
+
runs-on: ubuntu-20.04
|
10
|
+
steps:
|
11
|
+
- uses: actions/checkout@v3
|
12
|
+
- uses: ruby/setup-ruby@v1
|
13
|
+
with:
|
14
|
+
ruby-version: 2.7
|
15
|
+
- run: bundle update
|
16
|
+
- run: bundle exec rake
|
17
|
+
- uses: codecov/codecov-action@v3
|
18
|
+
with:
|
19
|
+
file: coverage/.resultset.json
|
20
|
+
fail_ci_if_error: true
|
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
name: rake
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
pull_request:
|
8
|
+
branches:
|
9
|
+
- master
|
10
|
+
jobs:
|
11
|
+
test:
|
12
|
+
name: test
|
13
|
+
strategy:
|
14
|
+
matrix:
|
15
|
+
os: [ubuntu-20.04, macos-12]
|
16
|
+
ruby: [2.7, 3.2]
|
17
|
+
runs-on: ${{ matrix.os }}
|
18
|
+
steps:
|
19
|
+
- uses: actions/checkout@v3
|
20
|
+
- uses: ruby/setup-ruby@v1
|
21
|
+
with:
|
22
|
+
ruby-version: ${{ matrix.ruby }}
|
23
|
+
- run: bundle update
|
24
|
+
- run: bundle exec rake
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
AllCops:
|
2
2
|
DisplayCopNames: true
|
3
3
|
TargetRubyVersion: 2.3
|
4
|
+
SuggestExtensions: false
|
5
|
+
NewCops: enable
|
4
6
|
|
5
7
|
Layout/EndOfLine:
|
6
8
|
EnforcedStyle: lf
|
7
|
-
|
9
|
+
Lint/MissingSuper:
|
8
10
|
Enabled: false
|
9
11
|
Layout/EmptyLineAfterGuardClause:
|
10
12
|
Enabled: false
|
@@ -24,5 +26,7 @@ Metrics/PerceivedComplexity:
|
|
24
26
|
Max: 10
|
25
27
|
Metrics/ParameterLists:
|
26
28
|
Max: 10
|
27
|
-
Layout/
|
29
|
+
Layout/ParameterAlignment:
|
30
|
+
Enabled: false
|
31
|
+
Style/OptionalBooleanParameter:
|
28
32
|
Enabled: false
|
data/.rultor.yml
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
+
docker:
|
2
|
+
image: yegor256/rultor-image:1.19.0
|
1
3
|
assets:
|
2
4
|
rubygems.yml: yegor256/home#assets/rubygems.yml
|
3
5
|
install: |-
|
4
|
-
|
5
|
-
export GEM_PATH=$GEM_HOME:$GEM_PATH
|
6
|
+
pdd -f /dev/null
|
6
7
|
sudo bundle install --no-color "--gemfile=$(pwd)/Gemfile"
|
7
8
|
release:
|
8
9
|
script: |-
|
@@ -18,7 +19,3 @@ merge:
|
|
18
19
|
script: |-
|
19
20
|
bundle install
|
20
21
|
bundle exec rake
|
21
|
-
deploy:
|
22
|
-
script: |-
|
23
|
-
echo 'Nothing to deploy'
|
24
|
-
exit -1
|
data/Gemfile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2020 Yegor Bugayenko
|
3
|
+
# Copyright (c) 2020-2023 Yegor Bugayenko
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -21,5 +21,11 @@
|
|
21
21
|
# SOFTWARE.
|
22
22
|
|
23
23
|
source 'https://rubygems.org'
|
24
|
-
ruby '~>2.3'
|
25
24
|
gemspec
|
25
|
+
|
26
|
+
gem 'minitest', '5.18.0', require: false
|
27
|
+
gem 'rake', '13.0.6', require: false
|
28
|
+
gem 'rdoc', '6.5.0', require: false
|
29
|
+
gem 'rubocop', '1.51.0', require: false
|
30
|
+
gem 'rubocop-rspec', '2.22.0', require: false
|
31
|
+
gem 'simplecov', '0.22.0', require: false
|
data/README.md
CHANGED
@@ -4,12 +4,10 @@
|
|
4
4
|
[](http://www.rultor.com/p/yegor256/veils)
|
5
5
|
[](https://www.jetbrains.com/ruby/)
|
6
6
|
|
7
|
-
[](https://ci.appveyor.com/project/yegor256/veils)
|
7
|
+
[](https://github.com/yegor256/veils/actions/workflows/rake.yml)
|
9
8
|
[](http://badge.fury.io/rb/veils)
|
10
9
|
[](https://codeclimate.com/github/yegor256/veils/maintainability)
|
11
10
|
[](http://rubydoc.info/github/yegor256/veils/master/frames)
|
12
|
-
|
13
11
|
[](https://hitsofcode.com/view/github/yegor256/veils)
|
14
12
|
[](https://github.com/yegor256/veils/blob/master/LICENSE.txt)
|
15
13
|
|
@@ -25,7 +23,7 @@ $ gem install veils
|
|
25
23
|
Then, use it like this:
|
26
24
|
|
27
25
|
```ruby
|
28
|
-
require '
|
26
|
+
require 'veil'
|
29
27
|
obj = Veil.new(obj, to_s: 'Hello, world!')
|
30
28
|
```
|
31
29
|
|
data/Rakefile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2020 Yegor Bugayenko
|
3
|
+
# Copyright (c) 2020-2023 Yegor Bugayenko
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
data/lib/alterin.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# (The MIT License)
|
4
4
|
#
|
5
|
-
# Copyright (c) 2020 Yegor Bugayenko
|
5
|
+
# Copyright (c) 2020-2023 Yegor Bugayenko
|
6
6
|
#
|
7
7
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
8
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -28,7 +28,7 @@
|
|
28
28
|
# {README}[https://github.com/yegor256/veils/blob/master/README.md] file.
|
29
29
|
#
|
30
30
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
31
|
-
# Copyright:: Copyright (c) 2020 Yegor Bugayenko
|
31
|
+
# Copyright:: Copyright (c) 2020-2023 Yegor Bugayenko
|
32
32
|
# License:: MIT
|
33
33
|
class AlterIn
|
34
34
|
def initialize(origin, methods = {})
|
@@ -47,9 +47,7 @@ class AlterIn
|
|
47
47
|
|
48
48
|
def method_missing(*args)
|
49
49
|
method = args[0]
|
50
|
-
unless @origin.respond_to?(method)
|
51
|
-
raise "Method #{method} is absent in #{@origin}"
|
52
|
-
end
|
50
|
+
raise "Method #{method} is absent in #{@origin}" unless @origin.respond_to?(method)
|
53
51
|
inputs = args[1..-1]
|
54
52
|
inputs = @methods[method].call(inputs) if @methods.key?(method)
|
55
53
|
if block_given?
|
@@ -62,7 +60,7 @@ class AlterIn
|
|
62
60
|
end
|
63
61
|
|
64
62
|
def respond_to?(method, include_private = false)
|
65
|
-
@origin.respond_to?(method, include_private) || @methods
|
63
|
+
@origin.respond_to?(method, include_private) || @methods.key?(method)
|
66
64
|
end
|
67
65
|
|
68
66
|
def respond_to_missing?(_method, _include_private = false)
|
data/lib/alterout.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# (The MIT License)
|
4
4
|
#
|
5
|
-
# Copyright (c) 2020 Yegor Bugayenko
|
5
|
+
# Copyright (c) 2020-2023 Yegor Bugayenko
|
6
6
|
#
|
7
7
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
8
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -28,7 +28,7 @@
|
|
28
28
|
# {README}[https://github.com/yegor256/veils/blob/master/README.md] file.
|
29
29
|
#
|
30
30
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
31
|
-
# Copyright:: Copyright (c) 2020 Yegor Bugayenko
|
31
|
+
# Copyright:: Copyright (c) 2020-2023 Yegor Bugayenko
|
32
32
|
# License:: MIT
|
33
33
|
class AlterOut
|
34
34
|
def initialize(origin, methods = {})
|
@@ -47,9 +47,7 @@ class AlterOut
|
|
47
47
|
|
48
48
|
def method_missing(*args)
|
49
49
|
method = args[0]
|
50
|
-
unless @origin.respond_to?(method)
|
51
|
-
raise "Method #{method} is absent in #{@origin}"
|
52
|
-
end
|
50
|
+
raise "Method #{method} is absent in #{@origin}" unless @origin.respond_to?(method)
|
53
51
|
out =
|
54
52
|
if block_given?
|
55
53
|
@origin.__send__(*args) do |*a|
|
@@ -63,7 +61,7 @@ class AlterOut
|
|
63
61
|
end
|
64
62
|
|
65
63
|
def respond_to?(method, include_private = false)
|
66
|
-
@origin.respond_to?(method, include_private) || @methods
|
64
|
+
@origin.respond_to?(method, include_private) || @methods.key?(method)
|
67
65
|
end
|
68
66
|
|
69
67
|
def respond_to_missing?(_method, _include_private = false)
|
data/lib/unpiercable.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# (The MIT License)
|
4
4
|
#
|
5
|
-
# Copyright (c) 2020 Yegor Bugayenko
|
5
|
+
# Copyright (c) 2020-2023 Yegor Bugayenko
|
6
6
|
#
|
7
7
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
8
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -29,7 +29,7 @@
|
|
29
29
|
# {README}[https://github.com/yegor256/veils/blob/master/README.md] file.
|
30
30
|
#
|
31
31
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
32
|
-
# Copyright:: Copyright (c) 2020 Yegor Bugayenko
|
32
|
+
# Copyright:: Copyright (c) 2020-2023 Yegor Bugayenko
|
33
33
|
# License:: MIT
|
34
34
|
class Unpiercable
|
35
35
|
def initialize(origin, methods = {})
|
@@ -51,9 +51,7 @@ class Unpiercable
|
|
51
51
|
if @methods.key?(method)
|
52
52
|
@methods[method]
|
53
53
|
else
|
54
|
-
unless @origin.respond_to?(method)
|
55
|
-
raise "Method #{method} is absent in #{@origin}"
|
56
|
-
end
|
54
|
+
raise "Method #{method} is absent in #{@origin}" unless @origin.respond_to?(method)
|
57
55
|
if block_given?
|
58
56
|
@origin.__send__(*args) do |*a|
|
59
57
|
yield(*a)
|
@@ -65,7 +63,7 @@ class Unpiercable
|
|
65
63
|
end
|
66
64
|
|
67
65
|
def respond_to?(method, include_private = false)
|
68
|
-
@origin.respond_to?(method, include_private) || @methods
|
66
|
+
@origin.respond_to?(method, include_private) || @methods.key?(method)
|
69
67
|
end
|
70
68
|
|
71
69
|
def respond_to_missing?(_method, _include_private = false)
|
data/lib/veil.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# (The MIT License)
|
4
4
|
#
|
5
|
-
# Copyright (c) 2020 Yegor Bugayenko
|
5
|
+
# Copyright (c) 2020-2023 Yegor Bugayenko
|
6
6
|
#
|
7
7
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
8
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -29,7 +29,7 @@
|
|
29
29
|
# {README}[https://github.com/yegor256/veils/blob/master/README.md] file.
|
30
30
|
#
|
31
31
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
32
|
-
# Copyright:: Copyright (c) 2020 Yegor Bugayenko
|
32
|
+
# Copyright:: Copyright (c) 2020-2023 Yegor Bugayenko
|
33
33
|
# License:: MIT
|
34
34
|
class Veil
|
35
35
|
def initialize(origin, methods = {})
|
@@ -51,9 +51,7 @@ class Veil
|
|
51
51
|
method = args[0]
|
52
52
|
if @pierced || !@methods.key?(method)
|
53
53
|
@pierced = true
|
54
|
-
unless @origin.respond_to?(method)
|
55
|
-
raise "Method #{method} is absent in #{@origin}"
|
56
|
-
end
|
54
|
+
raise "Method #{method} is absent in #{@origin}" unless @origin.respond_to?(method)
|
57
55
|
if block_given?
|
58
56
|
@origin.__send__(*args) do |*a|
|
59
57
|
yield(*a)
|
@@ -67,7 +65,7 @@ class Veil
|
|
67
65
|
end
|
68
66
|
|
69
67
|
def respond_to?(method, include_private = false)
|
70
|
-
@origin.respond_to?(method, include_private) || @methods
|
68
|
+
@origin.respond_to?(method, include_private) || @methods.key?(method)
|
71
69
|
end
|
72
70
|
|
73
71
|
def respond_to_missing?(_method, _include_private = false)
|
data/renovate.json
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# (The MIT License)
|
4
|
+
#
|
5
|
+
# Copyright (c) 2020-2023 Yegor Bugayenko
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
12
|
+
# furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
15
|
+
# copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
+
# SOFTWARE.
|
24
|
+
|
25
|
+
$stdout.sync = true
|
26
|
+
|
27
|
+
require 'simplecov'
|
28
|
+
SimpleCov.start
|
29
|
+
|
30
|
+
require 'minitest/autorun'
|
data/test/test_alterin.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# (The MIT License)
|
4
4
|
#
|
5
|
-
# Copyright (c) 2020 Yegor Bugayenko
|
5
|
+
# Copyright (c) 2020-2023 Yegor Bugayenko
|
6
6
|
#
|
7
7
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
8
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -28,7 +28,7 @@ require_relative '../lib/alterin'
|
|
28
28
|
|
29
29
|
# AlterIn test.
|
30
30
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
31
|
-
# Copyright:: Copyright (c) 2020 Yegor Bugayenko
|
31
|
+
# Copyright:: Copyright (c) 2020-2023 Yegor Bugayenko
|
32
32
|
# License:: MIT
|
33
33
|
class AlterInTest < Minitest::Test
|
34
34
|
def test_simple
|
@@ -39,4 +39,18 @@ class AlterInTest < Minitest::Test
|
|
39
39
|
foo = AlterIn.new(obj, plus: proc { |a, b| [a + 1, b + 1] })
|
40
40
|
assert_equal(7, foo.plus(2, 3))
|
41
41
|
end
|
42
|
+
|
43
|
+
def test_respond_to
|
44
|
+
foo = AlterIn.new(Object.new)
|
45
|
+
assert_equal(false, foo.respond_to?(:undefine_method))
|
46
|
+
|
47
|
+
foo = AlterIn.new(Object.new, method_return_object: Object.new)
|
48
|
+
assert_equal(true, foo.respond_to?(:method_return_object))
|
49
|
+
|
50
|
+
foo = AlterIn.new(Object.new, method_return_false: false)
|
51
|
+
assert_equal(true, foo.respond_to?(:method_return_false))
|
52
|
+
|
53
|
+
foo = AlterIn.new(Object.new, method_return_nil: nil)
|
54
|
+
assert_equal(true, foo.respond_to?(:method_return_nil))
|
55
|
+
end
|
42
56
|
end
|
data/test/test_alterout.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# (The MIT License)
|
4
4
|
#
|
5
|
-
# Copyright (c) 2020 Yegor Bugayenko
|
5
|
+
# Copyright (c) 2020-2023 Yegor Bugayenko
|
6
6
|
#
|
7
7
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
8
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -28,7 +28,7 @@ require_relative '../lib/alterout'
|
|
28
28
|
|
29
29
|
# AlterOut test.
|
30
30
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
31
|
-
# Copyright:: Copyright (c) 2020 Yegor Bugayenko
|
31
|
+
# Copyright:: Copyright (c) 2020-2023 Yegor Bugayenko
|
32
32
|
# License:: MIT
|
33
33
|
class AlterOutTest < Minitest::Test
|
34
34
|
def test_simple
|
@@ -39,4 +39,18 @@ class AlterOutTest < Minitest::Test
|
|
39
39
|
foo = AlterOut.new(obj, read: proc { |r| r + 1 })
|
40
40
|
assert_equal(6, foo.read(5))
|
41
41
|
end
|
42
|
+
|
43
|
+
def test_respond_to
|
44
|
+
foo = AlterOut.new(Object.new)
|
45
|
+
assert_equal(false, foo.respond_to?(:undefine_method))
|
46
|
+
|
47
|
+
foo = AlterOut.new(Object.new, method_return_object: Object.new)
|
48
|
+
assert_equal(true, foo.respond_to?(:method_return_object))
|
49
|
+
|
50
|
+
foo = AlterOut.new(Object.new, method_return_false: false)
|
51
|
+
assert_equal(true, foo.respond_to?(:method_return_false))
|
52
|
+
|
53
|
+
foo = AlterOut.new(Object.new, method_return_nil: nil)
|
54
|
+
assert_equal(true, foo.respond_to?(:method_return_nil))
|
55
|
+
end
|
42
56
|
end
|
data/test/test_unpiercable.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# (The MIT License)
|
4
4
|
#
|
5
|
-
# Copyright (c) 2020 Yegor Bugayenko
|
5
|
+
# Copyright (c) 2020-2023 Yegor Bugayenko
|
6
6
|
#
|
7
7
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
8
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -28,7 +28,7 @@ require_relative '../lib/unpiercable'
|
|
28
28
|
|
29
29
|
# Veil test.
|
30
30
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
31
|
-
# Copyright:: Copyright (c) 2020 Yegor Bugayenko
|
31
|
+
# Copyright:: Copyright (c) 2020-2023 Yegor Bugayenko
|
32
32
|
# License:: MIT
|
33
33
|
class UnpiercableTest < Minitest::Test
|
34
34
|
def test_simple
|
@@ -71,4 +71,18 @@ class UnpiercableTest < Minitest::Test
|
|
71
71
|
foo.each { |_| observed += 1 }
|
72
72
|
assert_equal(3, observed)
|
73
73
|
end
|
74
|
+
|
75
|
+
def test_respond_to
|
76
|
+
foo = Unpiercable.new(Object.new)
|
77
|
+
assert_equal(false, foo.respond_to?(:undefine_method))
|
78
|
+
|
79
|
+
foo = Unpiercable.new(Object.new, method_return_object: Object.new)
|
80
|
+
assert_equal(true, foo.respond_to?(:method_return_object))
|
81
|
+
|
82
|
+
foo = Unpiercable.new(Object.new, method_return_false: false)
|
83
|
+
assert_equal(true, foo.respond_to?(:method_return_false))
|
84
|
+
|
85
|
+
foo = Unpiercable.new(Object.new, method_return_nil: nil)
|
86
|
+
assert_equal(true, foo.respond_to?(:method_return_nil))
|
87
|
+
end
|
74
88
|
end
|
data/test/test_veil.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# (The MIT License)
|
4
4
|
#
|
5
|
-
# Copyright (c) 2020 Yegor Bugayenko
|
5
|
+
# Copyright (c) 2020-2023 Yegor Bugayenko
|
6
6
|
#
|
7
7
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
8
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -28,7 +28,7 @@ require_relative '../lib/veil'
|
|
28
28
|
|
29
29
|
# Veil test.
|
30
30
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
31
|
-
# Copyright:: Copyright (c) 2020 Yegor Bugayenko
|
31
|
+
# Copyright:: Copyright (c) 2020-2023 Yegor Bugayenko
|
32
32
|
# License:: MIT
|
33
33
|
class VeilTest < Minitest::Test
|
34
34
|
def test_simple
|
@@ -71,4 +71,18 @@ class VeilTest < Minitest::Test
|
|
71
71
|
foo.each { |_| observed += 1 }
|
72
72
|
assert_equal(3, observed)
|
73
73
|
end
|
74
|
+
|
75
|
+
def test_respond_to
|
76
|
+
foo = Veil.new(Object.new)
|
77
|
+
assert_equal(false, foo.respond_to?(:undefine_method))
|
78
|
+
|
79
|
+
foo = Veil.new(Object.new, method_return_object: Object.new)
|
80
|
+
assert_equal(true, foo.respond_to?(:method_return_object))
|
81
|
+
|
82
|
+
foo = Veil.new(Object.new, method_return_false: false)
|
83
|
+
assert_equal(true, foo.respond_to?(:method_return_false))
|
84
|
+
|
85
|
+
foo = Veil.new(Object.new, method_return_nil: nil)
|
86
|
+
assert_equal(true, foo.respond_to?(:method_return_nil))
|
87
|
+
end
|
74
88
|
end
|
data/veils.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# (The MIT License)
|
4
4
|
#
|
5
|
-
# Copyright (c) 2020 Yegor Bugayenko
|
5
|
+
# Copyright (c) 2020-2023 Yegor Bugayenko
|
6
6
|
#
|
7
7
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
8
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -24,14 +24,10 @@
|
|
24
24
|
|
25
25
|
require 'English'
|
26
26
|
Gem::Specification.new do |s|
|
27
|
-
s.
|
28
|
-
if s.respond_to? :required_rubygems_version=
|
29
|
-
s.required_rubygems_version = Gem::Requirement.new('>= 0')
|
30
|
-
end
|
31
|
-
s.rubygems_version = '2.3.3'
|
27
|
+
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
|
32
28
|
s.required_ruby_version = '>=2.3'
|
33
29
|
s.name = 'veils'
|
34
|
-
s.version = '0.
|
30
|
+
s.version = '0.4.0'
|
35
31
|
s.license = 'MIT'
|
36
32
|
s.summary = 'Ruby Veil Objects'
|
37
33
|
s.description = 'Decorate your existing Ruby object with veils
|
@@ -40,12 +36,7 @@ and some its methods will be cached.'
|
|
40
36
|
s.email = 'yegor256@gmail.com'
|
41
37
|
s.homepage = 'http://github.com/yegor256/veils'
|
42
38
|
s.files = `git ls-files`.split($RS)
|
43
|
-
s.test_files = s.files.grep(%r{^(test)/})
|
44
39
|
s.rdoc_options = ['--charset=UTF-8']
|
45
40
|
s.extra_rdoc_files = ['README.md']
|
46
|
-
s.
|
47
|
-
s.add_development_dependency 'rake', '12.3.3'
|
48
|
-
s.add_development_dependency 'rdoc', '4.3.0'
|
49
|
-
s.add_development_dependency 'rubocop', '0.62.0'
|
50
|
-
s.add_development_dependency 'rubocop-rspec', '1.31.0'
|
41
|
+
s.metadata['rubygems_mfa_required'] = 'true'
|
51
42
|
end
|
metadata
CHANGED
@@ -1,85 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: veils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yegor Bugayenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: minitest
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - '='
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 5.11.3
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - '='
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 5.11.3
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - '='
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 12.3.3
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - '='
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 12.3.3
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rdoc
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - '='
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 4.3.0
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - '='
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 4.3.0
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rubocop
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - '='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 0.62.0
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - '='
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: 0.62.0
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rubocop-rspec
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - '='
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 1.31.0
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - '='
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: 1.31.0
|
11
|
+
date: 2023-05-26 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
83
13
|
description: |-
|
84
14
|
Decorate your existing Ruby object with veils
|
85
15
|
and some its methods will be cached.
|
@@ -90,21 +20,25 @@ extra_rdoc_files:
|
|
90
20
|
- README.md
|
91
21
|
files:
|
92
22
|
- ".0pdd.yml"
|
23
|
+
- ".github/workflows/codecov.yml"
|
24
|
+
- ".github/workflows/pdd.yml"
|
25
|
+
- ".github/workflows/rake.yml"
|
26
|
+
- ".github/workflows/xcop.yml"
|
93
27
|
- ".gitignore"
|
94
28
|
- ".pdd"
|
95
29
|
- ".rubocop.yml"
|
96
30
|
- ".rultor.yml"
|
97
|
-
- ".travis.yml"
|
98
31
|
- Gemfile
|
99
32
|
- LICENSE.txt
|
100
33
|
- README.md
|
101
34
|
- Rakefile
|
102
|
-
- appveyor.yml
|
103
35
|
- lib/alterin.rb
|
104
36
|
- lib/alterout.rb
|
105
37
|
- lib/unpiercable.rb
|
106
38
|
- lib/veil.rb
|
107
39
|
- logo.svg
|
40
|
+
- renovate.json
|
41
|
+
- test/test__helper.rb
|
108
42
|
- test/test_alterin.rb
|
109
43
|
- test/test_alterout.rb
|
110
44
|
- test/test_unpiercable.rb
|
@@ -113,7 +47,8 @@ files:
|
|
113
47
|
homepage: http://github.com/yegor256/veils
|
114
48
|
licenses:
|
115
49
|
- MIT
|
116
|
-
metadata:
|
50
|
+
metadata:
|
51
|
+
rubygems_mfa_required: 'true'
|
117
52
|
post_install_message:
|
118
53
|
rdoc_options:
|
119
54
|
- "--charset=UTF-8"
|
@@ -130,12 +65,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
65
|
- !ruby/object:Gem::Version
|
131
66
|
version: '0'
|
132
67
|
requirements: []
|
133
|
-
rubygems_version: 3.
|
68
|
+
rubygems_version: 3.2.15
|
134
69
|
signing_key:
|
135
|
-
specification_version:
|
70
|
+
specification_version: 4
|
136
71
|
summary: Ruby Veil Objects
|
137
|
-
test_files:
|
138
|
-
- test/test_alterin.rb
|
139
|
-
- test/test_alterout.rb
|
140
|
-
- test/test_unpiercable.rb
|
141
|
-
- test/test_veil.rb
|
72
|
+
test_files: []
|
data/.travis.yml
DELETED
data/appveyor.yml
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
version: '{build}'
|
2
|
-
skip_tags: true
|
3
|
-
clone_depth: 10
|
4
|
-
branches:
|
5
|
-
only:
|
6
|
-
- master
|
7
|
-
except:
|
8
|
-
- gh-pages
|
9
|
-
os: Windows Server 2012
|
10
|
-
environment:
|
11
|
-
matrix:
|
12
|
-
- ruby_version: "25-x64"
|
13
|
-
install:
|
14
|
-
- ps: |
|
15
|
-
$Env:PATH = "C:\Ruby${Env:ruby_version}\bin;${Env:PATH}"
|
16
|
-
- bundle config --local path vendor/bundle
|
17
|
-
- ruby -v
|
18
|
-
- bundle -v
|
19
|
-
build_script:
|
20
|
-
- bundle update
|
21
|
-
- bundle install
|
22
|
-
test_script:
|
23
|
-
- bundle exec rake --quiet
|
24
|
-
cache:
|
25
|
-
- vendor/bundle
|