Sha256: c4a8a61aea5cbf06135d056adce888f894f17c57632a59701c805e7aeb8fd877

Contents?: true

Size: 812 Bytes

Versions: 3

Compression:

Stored size: 812 Bytes

Contents

class Spree::Report::Configuration
  attr_accessor :default_report_category, :default_report
  attr_reader :reports

  def initialize
    @reports = {}
  end

  def register_report_category(category)
    @reports[category] = []
  end

  def register_report(category, report_name)
    @reports[category] << report_name
  end

  def report_exists?(category, name)
    @reports.key?(category) && @reports[category].include?(name)
  end

  def reports_for_category(category)
    if category_exists? category
      @reports[category]
    else
      []
    end
  end

  def default_report_category
    @default_report_category || @reports.keys.first
  end

  def default_report
    @default_report || @reports[default_report_category].first
  end

  def category_exists?(category)
    @reports.key? category
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
spree_admin_insights-3.2.0 app/reports/spree/report/configuration.rb
solidus_admin_insights-2.1.1 app/reports/spree/report/configuration.rb
solidus_admin_insights-2.1.0 app/reports/spree/report/configuration.rb