# module Gear::Filters

### Public Class Methods

included(mod) click to toggle source

    # File lib/gear/filters.rb, line 24
    def self.included(mod)
      mod.extend(ClassMethods)
    end

setup(app, *a, &block) click to toggle source

    # File lib/gear/filters.rb, line 28
    def self.setup(app, *a, &block) end

### Public Instance Methods

run_filters(type) click to toggle source

    # File lib/gear/filters.rb, line 30
    def run_filters(type)
      o = self.class.to_s.split("::")
      filters = Object.const_get(o.first).filters
      filters[type].each do |filter|
        if (filter[0].is_a?(Symbol) && (filter[0] == o.last.to_sym || filter[0] == :all)) ||
           (filter[0].is_a?(String) && /^#{filter[0]}\/?$/ =~ @env.REQUEST_URI)
           self.instance_eval(&filter[1])
        end
      end
    end

service(*a) click to toggle source
Calls superclass method

    # File lib/gear/filters.rb, line 41
    def service(*a)
      run_filters(:before)
      super(*a)
      run_filters(:after)
      self
    end