Module: Redmine::Reporting

Defined in:
lib/redmine/reporting.rb,
lib/redmine/reporting/rails.rb,
lib/redmine/reporting/report.rb,
lib/redmine/reporting/railtie.rb,
lib/redmine/reporting/version.rb,
lib/redmine/reporting/configuration.rb,
lib/redmine/reporting/rails/middleware.rb,
lib/redmine/reporting/rails/controller_methods.rb

Defined Under Namespace

Modules: Rails Classes: Configuration, Railtie, Report

Constant Summary collapse

VERSION =
'0.1.5'

Class Method Summary collapse

Class Method Details

.configurationObject



14
15
16
# File 'lib/redmine/reporting.rb', line 14

def configuration
  @configuration ||= Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Yields:



10
11
12
# File 'lib/redmine/reporting.rb', line 10

def configure
  yield(configuration)
end

.report(subject_or_exception = nil, options = {}, &block) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/redmine/reporting.rb', line 18

def report(subject_or_exception=nil, options={}, &block)
  r = Report.new(options)

  if subject_or_exception.is_a?(Exception)
    r.subject(subject_or_exception.message)
    r.description do
      section("#{subject_or_exception.class}: #{subject_or_exception.message}") do
        output("<pre>#{subject_or_exception.backtrace.join("\n")}</pre>")
      end
    end
  elsif !subject_or_exception.nil?
    r.subject(subject_or_exception)
  end

  block.bind(r).call

  r.commit
end