Class: Padrino::Filter

### Home Classes Methods

### In Files

- lib/padrino-core/filter.rb

### Parent

Object

### Methods

- ::new
- #apply?
- #to_proc

### Files

- README.rdoc

### Class/Module Index

Quicksearch

- Padrino
- Padrino::Application
- Padrino::ApplicationLoadError
- Padrino::ApplicationSetup
- Padrino::ApplicationSetup::ClassMethods
- Padrino::AuthenticityToken
- Padrino::Cli
- Padrino::Cli::Adapter
- Padrino::Cli::Base
- Padrino::Cli::Launcher
- Padrino::Filter
- Padrino::Flash
- Padrino::Flash::Helpers
- Padrino::Flash::Storage
- Padrino::Loader
- Padrino::Logger
- Padrino::Logger::Colorize
- Padrino::Logger::Extensions
- Padrino::Logger::Rack
- Padrino::Module
- Padrino::Mounter
- Padrino::Mounter::ApplicationWrapper
- Padrino::Mounter::MounterException
- Padrino::ParamsProtection
- Padrino::ParamsProtection::ClassMethods
- Padrino::ParamsProtection::InstanceMethods
- Padrino::Reloader
- Padrino::Reloader::Rack
- Padrino::Reloader::Storage
- Padrino::Router
- Padrino::Routing
- Padrino::Routing::ClassMethods
- Padrino::Routing::InstanceMethods
- Padrino::Routing::Parent
- Padrino::Routing::UnrecognizedException
- Padrino::Server
- Padrino::ShowExceptions
- Padrino::Tasks
- HttpRouter
- HttpRouter::Node
- HttpRouter::Node::FreeRegex
- HttpRouter::Node::Glob
- HttpRouter::Node::Path
- HttpRouter::Node::SpanningRegex
- HttpRouter::Request
- HttpRouter::Route
- Sinatra
- Sinatra::Base
- Sinatra::Request
- Kernel
- Object
- PadrinoTasks

No matching classes.

# Padrino::Filter

### Attributes

block[R]

### Public Class Methods

new(mode, scoped_controller, options, args, &block) click to toggle source

    # File lib/padrino-core/filter.rb, line 5
    def initialize(mode, scoped_controller, options, args, &block)
      @mode = mode
      @scoped_controller = scoped_controller
      @options = options
      @args = args
      @block = block
    end

### Public Instance Methods

apply?(request) click to toggle source

    # File lib/padrino-core/filter.rb, line 13
    def apply?(request)
      detect = match_with_arguments?(request) || match_with_options?(request)
      detect ^ !@mode
    end

to_proc() click to toggle source

    # File lib/padrino-core/filter.rb, line 18
    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.