Class: Dossier::Report
- Inherits:
-
Object
- Object
- Dossier::Report
- Extended by:
- ActiveModel::Naming
- Includes:
- ActiveSupport::Callbacks
- Defined in:
- lib/dossier/report.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
- #dossier_client ⇒ Object
- #format_header(header) ⇒ Object
- #formatter ⇒ Object
-
#initialize(options = {}) ⇒ Report
constructor
A new instance of Report.
- #query ⇒ Object
- #raw_results ⇒ Object
- #results ⇒ Object
- #run ⇒ Object
- #sql ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Report
Returns a new instance of Report.
14 15 16 |
# File 'lib/dossier/report.rb', line 14 def initialize( = {}) @options = .dup.with_indifferent_access end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
8 9 10 |
# File 'lib/dossier/report.rb', line 8 def @options end |
Class Method Details
.report_name ⇒ Object
10 11 12 |
# File 'lib/dossier/report.rb', line 10 def self.report_name Dossier.class_to_name(self) end |
Instance Method Details
#dossier_client ⇒ Object
49 50 51 |
# File 'lib/dossier/report.rb', line 49 def dossier_client Dossier.client end |
#format_header(header) ⇒ Object
45 46 47 |
# File 'lib/dossier/report.rb', line 45 def format_header(header) formatter.titleize(header.to_s) end |
#formatter ⇒ Object
41 42 43 |
# File 'lib/dossier/report.rb', line 41 def formatter Dossier::Formatter end |
#query ⇒ Object
22 23 24 25 |
# File 'lib/dossier/report.rb', line 22 def query build_query unless defined?(@query) @query.to_s end |
#raw_results ⇒ Object
32 33 34 35 |
# File 'lib/dossier/report.rb', line 32 def raw_results execute unless defined?(@raw_results) @raw_results end |
#results ⇒ Object
27 28 29 30 |
# File 'lib/dossier/report.rb', line 27 def results execute unless defined?(@results) @results end |
#run ⇒ Object
37 38 39 |
# File 'lib/dossier/report.rb', line 37 def run tap { execute } end |
#sql ⇒ Object
18 19 20 |
# File 'lib/dossier/report.rb', line 18 def sql raise NotImplementedError, "`sql` method must be defined by each report" end |