Module: CampingFilters::ClassMethods

Defined in:
lib/filtering_camping.rb

Instance Method Summary collapse

Instance Method Details

#after(actions, &blk) ⇒ Object



14
15
16
17
18
19
# File 'lib/filtering_camping.rb', line 14

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



7
8
9
10
11
12
# File 'lib/filtering_camping.rb', line 7

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

#filtersObject



3
4
5
# File 'lib/filtering_camping.rb', line 3

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