Class: ActionController::Filters::ClassMethods::Filter

Inherits:
Object
  • Object
show all
Defined in:
lib/action_controller/filters.rb

Overview

Filter class is an abstract base class for all filters. Handles all of the included/excluded actions but contains no logic for calling the actual filters.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filter) ⇒ Filter

Returns a new instance of Filter.



398
399
400
# File 'lib/action_controller/filters.rb', line 398

def initialize(filter)
  @filter = filter
end

Instance Attribute Details

#excluded_actionsObject (readonly)

:nodoc:



396
397
398
# File 'lib/action_controller/filters.rb', line 396

def excluded_actions
  @excluded_actions
end

#filterObject (readonly)

:nodoc:



396
397
398
# File 'lib/action_controller/filters.rb', line 396

def filter
  @filter
end

#included_actionsObject (readonly)

:nodoc:



396
397
398
# File 'lib/action_controller/filters.rb', line 396

def included_actions
  @included_actions
end

Instance Method Details

#after?Boolean

Returns:

  • (Boolean)


410
411
412
# File 'lib/action_controller/filters.rb', line 410

def after?
  type == :after
end

#around?Boolean

Returns:

  • (Boolean)


414
415
416
# File 'lib/action_controller/filters.rb', line 414

def around?
  type == :around
end

#before?Boolean

Returns:

  • (Boolean)


406
407
408
# File 'lib/action_controller/filters.rb', line 406

def before?
  type == :before
end

#call(controller, &block) ⇒ Object



422
423
424
# File 'lib/action_controller/filters.rb', line 422

def call(controller, &block)
  run(controller)
end

#run(controller) ⇒ Object



418
419
420
# File 'lib/action_controller/filters.rb', line 418

def run(controller)
  raise ActionControllerError, 'No filter type: Nothing to do here.'
end

#typeObject



402
403
404
# File 'lib/action_controller/filters.rb', line 402

def type
  :around
end