Module: CampingFilters::ClassMethods

Defined in:
lib/bivouac/ext/filtering_camping.rb

Instance Method Summary collapse

Instance Method Details

#after(actions, &blk) ⇒ Object



17
18
19
20
21
22
# File 'lib/bivouac/ext/filtering_camping.rb', line 17

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



10
11
12
13
14
15
# File 'lib/bivouac/ext/filtering_camping.rb', line 10

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

#filtersObject



6
7
8
# File 'lib/bivouac/ext/filtering_camping.rb', line 6

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