Parent

Files

Padrino::Filter

Attributes

block[R]

Public Class Methods

new(mode, scoped_controller, options, args, &block) click to toggle source
# File lib/padrino-core/application/routing.rb, line 94
def initialize(mode, scoped_controller, options, args, &block)
  @mode, @scoped_controller, @options, @args, @block = mode, scoped_controller, options, args, block
end

Public Instance Methods

apply?(request) click to toggle source
# File lib/padrino-core/application/routing.rb, line 98
def apply?(request)
  detect = @args.any? do |arg|
    case arg
    when Symbol then request.route_obj && (request.route_obj.named == arg or request.route_obj.named == [@scoped_controller, arg].flatten.join("_").to_sym)
    else             arg === request.path_info
    end
  end || @options.any? do |name, val|
    case name
    when :agent then val === request.user_agent
    else             val === request.send(name)
    end
  end
  detect ^ !@mode
end
to_proc() click to toggle source
# File lib/padrino-core/application/routing.rb, line 113
def to_proc
  if @args.empty? && @options.empty?
    block
  else
    filter = self
    proc { instance_eval(&filter.block) if filter.apply?(request) }
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.