Module: Tadpole::Filters::InstanceMethods

Defined in:
lib/tadpole/filters.rb

Instance Method Summary collapse

Instance Method Details

#run_before_runObject



30
31
32
33
34
35
36
# File 'lib/tadpole/filters.rb', line 30

def run_before_run
  self.class.before_run_filters.each do |meth|
    meth = method(meth) if meth.is_a?(Symbol)
    result = meth.call 
    return result if result.is_a?(FalseClass)
  end
end

#run_before_sectionsObject



38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/tadpole/filters.rb', line 38

def run_before_sections
  self.class.before_section_filters.each do |info|
    result, sec, meth = nil, *info
    if sec.nil? || sec.to_s == current_section.to_s
      meth = method(meth) if meth.is_a?(Symbol)
      args = meth.arity == 0 ? [] : [current_section]
      result = meth.call(*args)
    end

    return result if result.is_a?(FalseClass)
  end
end