Module: Garb::ProfileReports

Included in:
Management::Profile, 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
14
# 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.name.demodulize.underscore
  return unless method_name.length > 0

  class_eval "    def \#{method_name}(opts = {}, &block)\n      \#{klass}.results(self, opts, &block)\n    end\n  CODE\nend\n"