Class: Spree::Report::Configuration

Inherits:
Object
  • Object
show all
Defined in:
app/reports/spree/report/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

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_reportObject

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_categoryObject

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

#reportsObject (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

Returns:

  • (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

Returns:

  • (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