class Filter を読む
公開日:
:
最終更新日:2014/01/31
Ruby on Rails
actionpack-1.13.6/lib/action_controller/filters.rb で定義されていた。
# 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.
class Filter #:nodoc:
attr_reader :filter, :included_actions, :excluded_actions
def initialize(filter)
@filter = filter
end
def type
:around
end
def before?
type == :before
end
def after?
type == :after
end
def around?
type == :around
end
def run(controller)
raise ActionControllerError, 'No filter type: Nothing to do here.'
end
def call(controller, &block)
run(controller)
end
end
関連記事
- PREV
- verifyまわりのコードを読む
- NEXT
- rubyの0がtrueな件