Class: Spree::Report::Configuration
- Inherits:
-
Object
- Object
- Spree::Report::Configuration
- Defined in:
- app/reports/spree/report/configuration.rb
Instance Attribute Summary collapse
-
#default_report ⇒ Object
Returns the value of attribute default_report.
-
#default_report_category ⇒ Object
Returns the value of attribute default_report_category.
-
#reports ⇒ Object
readonly
Returns the value of attribute reports.
Instance Method Summary collapse
- #category_exists?(category) ⇒ Boolean
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #register_report(category, report_name) ⇒ Object
- #register_report_category(category) ⇒ Object
- #report_exists?(category, name) ⇒ Boolean
- #reports_for_category(category) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
5 6 7 |
# File 'app/reports/spree/report/configuration.rb', line 5 def initialize @reports = {} end |
Instance Attribute Details
#default_report ⇒ Object
Returns the value of attribute default_report.
2 3 4 |
# File 'app/reports/spree/report/configuration.rb', line 2 def default_report @default_report end |
#default_report_category ⇒ Object
Returns the value of attribute default_report_category.
2 3 4 |
# File 'app/reports/spree/report/configuration.rb', line 2 def default_report_category @default_report_category end |
#reports ⇒ Object (readonly)
Returns the value of attribute reports.
3 4 5 |
# File 'app/reports/spree/report/configuration.rb', line 3 def reports @reports end |
Instance Method Details
#category_exists?(category) ⇒ Boolean
37 38 39 |
# File 'app/reports/spree/report/configuration.rb', line 37 def category_exists?(category) @reports.key? category end |
#register_report(category, report_name) ⇒ Object
13 14 15 |
# File 'app/reports/spree/report/configuration.rb', line 13 def register_report(category, report_name) @reports[category] << report_name end |
#register_report_category(category) ⇒ Object
9 10 11 |
# File 'app/reports/spree/report/configuration.rb', line 9 def register_report_category(category) @reports[category] = [] end |
#report_exists?(category, name) ⇒ Boolean
17 18 19 |
# File 'app/reports/spree/report/configuration.rb', line 17 def report_exists?(category, name) @reports.key?(category) && @reports[category].include?(name) end |
#reports_for_category(category) ⇒ Object
21 22 23 24 25 26 27 |
# File 'app/reports/spree/report/configuration.rb', line 21 def reports_for_category(category) if category_exists? category @reports[category] else [] end end |