interloper 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9a4c42296850197574e9584a94a4d5558b51a394
4
- data.tar.gz: 231d3a66afb42b72dbdf095dfa408d59e9962fb8
3
+ metadata.gz: 064c0ba76ebb460dc19eca46ac6df915c73043c0
4
+ data.tar.gz: 7a055d93858d21e1b21a99284b8b87e7f7f8a258
5
5
  SHA512:
6
- metadata.gz: b0e347bac1a8c4b796a4c44e191a8d45ad5f7bffa528a3f3bf39468b3ff05b59e6d185c31c0e3ea7f35d2fb148af5b1ab180a1488a9374b4898f167c2ff719fa
7
- data.tar.gz: 3251971fd52654301b5d809a24388d812d12959b0ef14e2b45f7479887ce42f6519e3c40effd5a1d0a5686412ddd19cdc424f719d1d4508cd9fc04900f863d0e
6
+ metadata.gz: f1bf227a3d8b5296ee34f1e9a2b69438e27b534b21564350ff7086a29067d0b38d21535f3f54cb67a10c1d9242e1dacbecdb97329d17bc084cea787429a3e2d0
7
+ data.tar.gz: b44c9dd4a5c19d9a84a8cc7240cd332ce26cec082577c0a001cc0b2b9fc03f1efdc080e22316435e985b7546c5eff7463bc5b056171b415152accf7ed4db6b6c
@@ -1,3 +1,3 @@
1
1
  module Interloper
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
data/lib/interloper.rb CHANGED
@@ -26,11 +26,11 @@ module Interloper
26
26
  # @return Module the Interloper module that was prepended to the including
27
27
  # class.
28
28
  def interloper_module
29
- unless prepended? interloper_const_name
29
+ @interloper_module ||= begin
30
30
  const_set(interloper_const_name, generate_interloper_module)
31
31
  prepend const_get(interloper_const_name)
32
+ const_get(interloper_const_name)
32
33
  end
33
- const_get(interloper_const_name)
34
34
  end
35
35
 
36
36
  # @return Boolean True if the interloper module has already been prepnded;]
@@ -139,21 +139,21 @@ module Interloper
139
139
  end
140
140
 
141
141
  def inherit_callbacks_before(*method_names)
142
- inherited_callbacks(:before, *method_names).each do |callback|
142
+ ancestor_callbacks(:before, *method_names).each do |callback|
143
143
  before(*method_names, &callback)
144
144
  end
145
145
  end
146
146
 
147
147
  def inherit_callbacks_after(*method_names)
148
- inherited_callbacks(:after, *method_names).each do |callback|
148
+ ancestor_callbacks(:after, *method_names).each do |callback|
149
149
  after(*method_names, &callback)
150
150
  end
151
151
  end
152
152
 
153
- def inherited_callbacks(hook, *method_names)
153
+ def ancestor_callbacks(hook, *method_names)
154
154
  method_names.map do |method_name|
155
155
  ancestor_interloper_module.callbacks[hook][method_name]
156
- end.flatten
156
+ end.flatten.compact
157
157
  end
158
158
 
159
159
  # @return [Module] The nearest ancstors tha is an interloper module.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: interloper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Myers