class Mengpaneel::CallProxy
Attributes
args[R]
calls[R]
method_name[R]
Public Class Methods
new(method_name = nil, args = [])
click to toggle source
# File lib/mengpaneel/call_proxy.rb, line 7 def initialize(method_name = nil, args = []) @method_name = method_name @args = args @calls = [] end
Public Instance Methods
all_calls(prefixes = [])
click to toggle source
# File lib/mengpaneel/call_proxy.rb, line 35 def all_calls(prefixes = []) calls = [] calls << to_call(prefixes) if self.method_name && (@calls.empty? || !@args.empty?) calls += child_calls(prefixes) calls end
child_calls(prefixes = [])
click to toggle source
# File lib/mengpaneel/call_proxy.rb, line 30 def child_calls(prefixes = []) method_name = full_method_name(prefixes) @calls.flat_map { |proxy| proxy.all_calls(method_name) } end
full_method_name(prefixes)
click to toggle source
# File lib/mengpaneel/call_proxy.rb, line 22 def full_method_name(prefixes) [*prefixes, *self.method_name] end
method_missing(method_name, *args)
click to toggle source
# File lib/mengpaneel/call_proxy.rb, line 14 def method_missing(method_name, *args) save_call(method_name, *args) end
respond_to_missing?(method_name, include_private = false)
click to toggle source
# File lib/mengpaneel/call_proxy.rb, line 18 def respond_to_missing?(method_name, include_private = false) true end
to_call(prefixes = [])
click to toggle source
# File lib/mengpaneel/call_proxy.rb, line 26 def to_call(prefixes = []) [full_method_name(prefixes), args] if self.method_name end
Private Instance Methods
save_call(method_name, *args)
click to toggle source
# File lib/mengpaneel/call_proxy.rb, line 43 def save_call(method_name, *args) proxy = self.class.new(method_name, args) @calls << proxy proxy end