Class: Rango::CallableStrategy

to(Rango.logger.method(:debug))

> Rango.logger.debug(request, *args)

Public Visibility

Public Instance Method Summary

#match?(request, params, *args, &block)
#run(request, params, *args, &block)

Public Instance Methods Inherited from Rango::RouterStrategy

register

Public Instance Method Details

match?

public match?(request, params, *args, &block)
[View source]


38
39
40
# File 'lib/rango/router/strategies.rb', line 38

def match?(request, params, *args, &block)
  (args.length.eql?(1) && args.first.respond_to?(:call)) || block_given?
end

run

public run(request, params, *args, &block)
[View source]


42
43
44
45
46
# File 'lib/rango/router/strategies.rb', line 42

def run(request, params, *args, &block)
  callable = args.first || block
  args = params.map { |key, value| value }
  callable.call(request, *args)
end