Class: Padrino::Filter

Inherits:
Object
  • Object
show all
Defined in:
lib/pendragon/padrino/ext/class_methods.rb

Instance Method Summary collapse

Instance Method Details

#apply?(request) ⇒ Boolean

Returns:

  • (Boolean)


302
303
304
305
306
307
308
309
310
311
312
313
314
315
# File 'lib/pendragon/padrino/ext/class_methods.rb', line 302

def apply?(request)
  detect = @args.any? do |arg|
    case arg
    when Symbol then request.route_obj && (request.route_obj.name == arg or request.route_obj.name == [@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