Module: Garb::ProfileReports

Included in:
Profile
Defined in:
lib/garb/profile_reports.rb

Class Method Summary collapse

Class Method Details

.add_report_method(klass) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/garb/profile_reports.rb', line 3

def self.add_report_method(klass)
  # demodulize leaves potential to redefine
  # these methods given different namespaces
  method_name = klass.to_s.demodulize.underscore

  class_eval <<-CODE
    def #{method_name}(opts = {}, &block)
      #{klass}.results(self, opts, &block)
    end
  CODE
end