classproxy 0.7.12 → 0.7.13
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.
- data/lib/classproxy/classproxy.rb +25 -15
- data/lib/classproxy/version.rb +1 -1
- metadata +2 -2
@@ -154,24 +154,34 @@ module ClassProxy
|
|
154
154
|
|
155
155
|
custom_fallback = !!self.respond_to?(fallback_method)
|
156
156
|
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
157
|
+
begin
|
158
|
+
if custom_fallback and not @fallbacks_used.include? method_name
|
159
|
+
send_args = [fallback_method]
|
160
|
+
|
161
|
+
if self.method(fallback_method).arity == 1
|
162
|
+
def_fallback_obj = self.class.instance_variable_get(:@fallback_fetch)[self]
|
163
|
+
send_args << def_fallback_obj
|
164
|
+
end
|
165
|
+
|
166
|
+
@fallbacks_used << method_name
|
167
|
+
elsif not custom_fallback and not @fallbacks_used.include? "default"
|
168
|
+
args_class = ArgsClass.new(self)
|
169
|
+
self.class.send :run_fallback, args_class, self
|
170
|
+
|
171
|
+
# The value might have changed, so check here
|
172
|
+
send_args = ["no_proxy_#{method_name}".to_sym]
|
163
173
|
end
|
164
174
|
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
175
|
+
v = self.send(*send_args) if send_args
|
176
|
+
rescue NotFound
|
177
|
+
if custom_fallback and not @fallbacks_used.include? "default"
|
178
|
+
# If a custom callback raises NotFound, run the default fallback
|
179
|
+
# (if it hasn't been used previously), that way the default fallback
|
180
|
+
# has a chance to set the method that had been overriden previously
|
181
|
+
custom_fallback = false
|
182
|
+
retry
|
183
|
+
end
|
172
184
|
end
|
173
|
-
|
174
|
-
v = self.send(*send_args) if send_args
|
175
185
|
self.send("#{method_name}=", v) if v and custom_fallback
|
176
186
|
|
177
187
|
@mutex_in_call_for.delete method_name
|
data/lib/classproxy/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: classproxy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.13
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -55,7 +55,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
55
55
|
version: '0'
|
56
56
|
segments:
|
57
57
|
- 0
|
58
|
-
hash:
|
58
|
+
hash: -1607131441686129206
|
59
59
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
60
|
none: false
|
61
61
|
requirements:
|