around_the_world 0.23.4 → 0.23.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -8
- data/lib/around_the_world.rb +15 -11
- data/lib/around_the_world/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f333b590dcf391d8183041e7e07d9a0e3449f512877fd2292303454493e5d99
|
4
|
+
data.tar.gz: 19af144b596a775a74d0c79a55cb24102d07a37b1b96051a9a968ab53caece3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca64d7ef50f18b5939d927e672ab8e819b2a3e981063781141c2f96d9aedb8c81ad9c675e8f03f04f3af5c6f0f5b6ea4891c7e07605a8cbae40c1060a75cb28f
|
7
|
+
data.tar.gz: fe376821a59725a78eb8e06ce13a5f3e4cd23a14b3ae4f95bc105bebcfcf3547eb9c59051cabc2dc7d9cc56c3f87b3d3482d1788db8c7aa11c52a8ec07ab9783
|
data/README.md
CHANGED
@@ -48,8 +48,12 @@ class SomeClass
|
|
48
48
|
!!@something_happened
|
49
49
|
end
|
50
50
|
|
51
|
-
around_method :make_something_happen!, :did_something_happened? do |*args
|
52
|
-
|
51
|
+
around_method :make_something_happen!, :did_something_happened? do |*args| # use |...| for ruby 2.7+
|
52
|
+
# For Ruby <= 2.6:
|
53
|
+
things_happened = super(*args)
|
54
|
+
|
55
|
+
#Or, for Ruby <= 2.7:
|
56
|
+
things_happened = super(...)
|
53
57
|
|
54
58
|
if things_happened
|
55
59
|
"Something happened!"
|
@@ -82,12 +86,12 @@ class SomeClass
|
|
82
86
|
"method behavior"
|
83
87
|
end
|
84
88
|
|
85
|
-
around_method :some_method, prevent_double_wrapping_for: :memoization do
|
86
|
-
@memoized ||= super(
|
89
|
+
around_method :some_method, prevent_double_wrapping_for: :memoization do |...|
|
90
|
+
@memoized ||= super(...)
|
87
91
|
end
|
88
92
|
|
89
|
-
around_method :some_method, prevent_double_wrapping_for: :memoization do
|
90
|
-
@memoized ||= super(
|
93
|
+
around_method :some_method, prevent_double_wrapping_for: :memoization do |...|
|
94
|
+
@memoized ||= super(...)
|
91
95
|
end
|
92
96
|
end
|
93
97
|
```
|
@@ -108,8 +112,8 @@ class SomeClass
|
|
108
112
|
|
109
113
|
def a_singleton_method; end
|
110
114
|
|
111
|
-
around_method :a_singleton_method do
|
112
|
-
super(
|
115
|
+
around_method :a_singleton_method do |...|
|
116
|
+
super(...) # See above for ruby <= 2.6 syntax
|
113
117
|
|
114
118
|
"It works for class methods too!"
|
115
119
|
end
|
data/lib/around_the_world.rb
CHANGED
@@ -23,9 +23,13 @@ module AroundTheWorld
|
|
23
23
|
#
|
24
24
|
# @example
|
25
25
|
# class SomeClass
|
26
|
-
# around_method :
|
27
|
-
#
|
28
|
-
#
|
26
|
+
# around_method :make_something_happen!, :did_something_happened? do |*args| # use |...| for ruby 2.7+
|
27
|
+
# # For Ruby <= 2.6:
|
28
|
+
# things_happened = super(*args)
|
29
|
+
|
30
|
+
# #Or, for Ruby <= 2.7:
|
31
|
+
# things_happened = super(...)
|
32
|
+
|
29
33
|
# if things_happened
|
30
34
|
# "Something happened!"
|
31
35
|
# else
|
@@ -42,19 +46,19 @@ module AroundTheWorld
|
|
42
46
|
# => "Something happened!"
|
43
47
|
#
|
44
48
|
# @example
|
45
|
-
# around_method :dont_look_in_here, prevent_double_wrapping_for: :memoization do
|
46
|
-
# @memoized ||= super(
|
49
|
+
# around_method :dont_look_in_here, prevent_double_wrapping_for: :memoization do |...|
|
50
|
+
# @memoized ||= super(...)
|
47
51
|
# end
|
48
52
|
#
|
49
|
-
# around_method :dont_look_in_here, prevent_double_wrapping_for: :memoization do
|
50
|
-
# @memoized ||= super(
|
53
|
+
# around_method :dont_look_in_here, prevent_double_wrapping_for: :memoization do |...|
|
54
|
+
# @memoized ||= super(...)
|
51
55
|
# end
|
52
56
|
# # => AroundTheWorld::DoubleWrapError:
|
53
57
|
# "Module AroundTheWorld:ProxyModule:memoization already defines the method :dont_look_in_here"
|
54
58
|
#
|
55
|
-
# around_method :dont_look_in_here do
|
59
|
+
# around_method :dont_look_in_here do |...|
|
56
60
|
# do_something_else
|
57
|
-
# super(
|
61
|
+
# super(...)
|
58
62
|
# end
|
59
63
|
# # => no error raised
|
60
64
|
#
|
@@ -65,8 +69,8 @@ module AroundTheWorld
|
|
65
69
|
# class << self
|
66
70
|
# def a_singleton_method; end
|
67
71
|
#
|
68
|
-
# around_method :a_singleton_method do
|
69
|
-
# super(
|
72
|
+
# around_method :a_singleton_method do |...|
|
73
|
+
# super(...)
|
70
74
|
# "It works for class methods too!"
|
71
75
|
# end
|
72
76
|
# end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: around_the_world
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.23.
|
4
|
+
version: 0.23.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Allen Rettberg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -47,7 +47,7 @@ metadata:
|
|
47
47
|
homepage_uri: https://github.com/Freshly/spicerack/tree/master/around_the_world
|
48
48
|
source_code_uri: https://github.com/Freshly/spicerack/tree/master/around_the_world
|
49
49
|
changelog_uri: https://github.com/Freshly/spicerack/blob/master/around_the_world/CHANGELOG.md
|
50
|
-
documentation_uri: https://www.rubydoc.info/gems/around_the_world/0.23.
|
50
|
+
documentation_uri: https://www.rubydoc.info/gems/around_the_world/0.23.5
|
51
51
|
post_install_message:
|
52
52
|
rdoc_options: []
|
53
53
|
require_paths:
|
@@ -63,7 +63,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
63
|
- !ruby/object:Gem::Version
|
64
64
|
version: '0'
|
65
65
|
requirements: []
|
66
|
-
|
66
|
+
rubyforge_project:
|
67
|
+
rubygems_version: 2.7.6
|
67
68
|
signing_key:
|
68
69
|
specification_version: 4
|
69
70
|
summary: Allows you to easily wrap methods with custom logic on any class
|