Module: Gear::Filters::ClassMethods

Defined in:
lib/camping/gear/filters.rb

Instance Method Summary collapse

Instance Method Details

#after(actions, &blk) ⇒ Object



16
17
18
19
20
21
# File 'lib/camping/gear/filters.rb', line 16

def after(actions, &blk)
  actions = [actions] unless actions.is_a?(Array)
  actions.each do |action|
    filters[:after] << [action, blk]
  end
end

#before(actions, &blk) ⇒ Object



9
10
11
12
13
14
# File 'lib/camping/gear/filters.rb', line 9

def before(actions, &blk)
  actions = [actions] unless actions.is_a?(Array)
  actions.each do |action|
    filters[:before] << [action, blk]
  end
end

#filtersObject



5
6
7
# File 'lib/camping/gear/filters.rb', line 5

def filters
  @_filters ||= {:before => [], :after => []}
end