Class: SirTracksAlot::Reports::RootStemReport

Inherits:
FilterReport show all
Defined in:
lib/sir_tracks_alot/reports/root_stem_report.rb

Defined Under Namespace

Modules: Helpers Classes: HTML

Constant Summary

Constants inherited from FilterReport

FilterReport::COLUMN_NAMES

Instance Attribute Summary

Attributes inherited from SirTracksAlotReport

#all

Attributes inherited from Report

#all

Instance Method Summary collapse

Methods inherited from Report

build_rows

Instance Method Details

#setupObject

Build up reports by filtering things as follows: actions = [] roots = {}



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/sir_tracks_alot/reports/root_stem_report.rb', line 11

def setup        
  options.actions ||= Activity::ACTIONS
  options.filters ||= {}
  
  options.actions.each do |action|
    options.roots.each do |root|
      cat, target = root.kind_of?(Array) ? root : [root, root]
      
      begin
        options.filters["#{cat||target} index"] = {:category => cat, :target => /^\/#{target}$/, :action => action}
        options.filters["#{cat||target} pages"] = {:category => cat, :target => /^\/#{target}\/.+$/, :action => action}
      rescue RegexpError
        # swallow
      end
    end
  end
  
  super
end