12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/concealer/proxy.rb', line 12
def method_missing(name, *args, &block)
check_concealed = /(.+)_allowed\?$/.match(name.to_s).try(:[], 1).try(:to_sym)
if check_concealed && @target.respond_to?(check_concealed)
return @strategy.allow?(@target, check_concealed, args)
end
if !@target.respond_to?(name)
raise NoMethodError, "#{@target} does not respond to #{name}"
elsif @strategy.allow?(@target, name, args)
@target.send(name, *args, &block)
else
Concealer.fallback_for(@target, name).call(@target, name, args)
end
end
|