Module: SirTracksAlot::Reports::Report::Helpers

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.handle(name, &block) ⇒ Object


27
28
29
30
31
32
33
34
# File 'lib/sir_tracks_alot/reports/report.rb', line 27

def self.handle(name, &block)
  @@handlers ||= {}
  name = [name] unless name.kind_of?(Array)

  name.each do |n|
    @@handlers[n] = block          
  end
end

Instance Method Details

#render_data(name, value) ⇒ Object


40
41
42
43
44
# File 'lib/sir_tracks_alot/reports/report.rb', line 40

def render_data(name, value)
  @@handlers ||= {}          
  return value if !@@handlers.include?(name)
  @@handlers[name].call(value)
end

#to_dom_class(words) ⇒ Object


36
37
38
# File 'lib/sir_tracks_alot/reports/report.rb', line 36

def to_dom_class(words)
  (words||'').gsub(/[^a-z0-9]/, '_')
end