around_the_world 0.23.4 → 0.24.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/README.md +12 -8
- data/lib/around_the_world.rb +15 -11
- data/lib/around_the_world/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 547a9d3c61c5dfe4e82a1981a2654289ece99846b91fb8897470b83a48a2d7c7
|
4
|
+
data.tar.gz: 330e189d0daf3ca880b33618c4032c5ce620a6832c5f5fae09704c00b520374d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a4a5f9799131e97ecff99d8d84090a1aef316528d687a17798d8665d9d18a4b1be062c93b8f229556b1d23da1505fc7b941e551cd20d5d71daae31fa3c3c5df
|
7
|
+
data.tar.gz: 17bcba1c91f1fc05e2d32b2b694ad7d844a1508da0c68a6fbb7e4c7261b03eecc471a0145257a0871416330fedb101d100a081bfaf27b1b4f369c0577e42794f
|
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.
|
4
|
+
version: 0.24.0
|
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-07-28 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.
|
50
|
+
documentation_uri: https://www.rubydoc.info/gems/around_the_world/0.24.0
|
51
51
|
post_install_message:
|
52
52
|
rdoc_options: []
|
53
53
|
require_paths:
|
@@ -63,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
63
|
- !ruby/object:Gem::Version
|
64
64
|
version: '0'
|
65
65
|
requirements: []
|
66
|
-
rubygems_version: 3.1.
|
66
|
+
rubygems_version: 3.1.4
|
67
67
|
signing_key:
|
68
68
|
specification_version: 4
|
69
69
|
summary: Allows you to easily wrap methods with custom logic on any class
|