Class: Reactive::Mvc::Controller::Filters::ClassMethods::Filter

Inherits:
Object
  • Object
show all
Defined in:
lib/reactive-mvc/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.



397
398
399
# File 'lib/reactive-mvc/controller/filters.rb', line 397

def initialize(filter)
  @filter = filter
end

Instance Attribute Details

#excluded_actionsObject (readonly)

:nodoc:



395
396
397
# File 'lib/reactive-mvc/controller/filters.rb', line 395

def excluded_actions
  @excluded_actions
end

#filterObject (readonly)

:nodoc:



395
396
397
# File 'lib/reactive-mvc/controller/filters.rb', line 395

def filter
  @filter
end

#included_actionsObject (readonly)

:nodoc:



395
396
397
# File 'lib/reactive-mvc/controller/filters.rb', line 395

def included_actions
  @included_actions
end

Instance Method Details

#after?Boolean

Returns:

  • (Boolean)


409
410
411
# File 'lib/reactive-mvc/controller/filters.rb', line 409

def after?
  type == :after
end

#around?Boolean

Returns:

  • (Boolean)


413
414
415
# File 'lib/reactive-mvc/controller/filters.rb', line 413

def around?
  type == :around
end

#before?Boolean

Returns:

  • (Boolean)


405
406
407
# File 'lib/reactive-mvc/controller/filters.rb', line 405

def before?
  type == :before
end

#call(controller, &block) ⇒ Object



421
422
423
# File 'lib/reactive-mvc/controller/filters.rb', line 421

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

#run(controller) ⇒ Object

Raises:

  • (Reactive::Controller::Error)


417
418
419
# File 'lib/reactive-mvc/controller/filters.rb', line 417

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

#typeObject



401
402
403
# File 'lib/reactive-mvc/controller/filters.rb', line 401

def type
  :around
end