Class: QueryReport::Report
- Inherits:
-
Object
- Object
- QueryReport::Report
- Includes:
- ChartAdapterModule, ColumnModule, FilterModule, PaginateModule, Record
- Defined in:
- lib/query_report/report.rb
Instance Attribute Summary collapse
-
#charts ⇒ Object
readonly
Returns the value of attribute charts.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#template ⇒ Object
readonly
Returns the value of attribute template.
Attributes included from Record
Attributes included from FilterModule
Attributes included from ColumnModule
Instance Method Summary collapse
- #has_chart? ⇒ Boolean
- #has_total? ⇒ Boolean
-
#initialize(params, template, options = {}, &block) ⇒ Report
constructor
A new instance of Report.
-
#method_missing(meth, *args, &block) ⇒ Object
to support the helper methods.
- #paginate? ⇒ Boolean
Methods included from ChartAdapterModule
Methods included from Record
#all_records, #all_records_to_render, #apply, #array_record?, #content_from_element, #filtered_query, #has_any_rowspan?, #map_record, #map_rowspan, #model_class, #paginated_query, #records, #records_to_render, #search
Methods included from PaginateModule
Methods included from FilterModule
#apply_filters, #filter, #has_filter?, #load_default_values_in_param, #ordered_param_value_objects
Methods included from ColumnModule
#column, #column_total_with_colspan
Constructor Details
#initialize(params, template, options = {}, &block) ⇒ Report
Returns a new instance of Report.
19 20 21 22 23 24 |
# File 'lib/query_report/report.rb', line 19 def initialize(params, template, ={}, &block) @params, @template = params, template @columns, @filters, @charts = [], [], [] @options = QueryReport::DEFAULT_OPTIONS.merge instance_eval &block if block_given? end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object
to support the helper methods
50 51 52 53 54 55 56 |
# File 'lib/query_report/report.rb', line 50 def method_missing(meth, *args, &block) if @template.respond_to?(meth) @template.send(meth, *args) else super end end |
Instance Attribute Details
#charts ⇒ Object (readonly)
Returns the value of attribute charts.
11 12 13 |
# File 'lib/query_report/report.rb', line 11 def charts @charts end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
11 12 13 |
# File 'lib/query_report/report.rb', line 11 def @options end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
11 12 13 |
# File 'lib/query_report/report.rb', line 11 def params @params end |
#template ⇒ Object (readonly)
Returns the value of attribute template.
11 12 13 |
# File 'lib/query_report/report.rb', line 11 def template @template end |
Instance Method Details
#has_chart? ⇒ Boolean
35 36 37 |
# File 'lib/query_report/report.rb', line 35 def has_chart? !@charts.empty? end |
#has_total? ⇒ Boolean
39 40 41 |
# File 'lib/query_report/report.rb', line 39 def has_total? @columns.any?(&:has_total?) end |
#paginate? ⇒ Boolean
43 44 45 46 47 |
# File 'lib/query_report/report.rb', line 43 def paginate? return false if array_record? #do not paginate on the array records return true if @options[:paginate].nil? @options[:paginate] end |