Sha256: ec99d74612df93ec6d30739cae7e5e4505c69e32000cf16f14c320e60c43b856

Contents?: true

Size: 1.36 KB

Versions: 2

Compression:

Stored size: 1.36 KB

Contents

module Avo
  class Configuration
    attr_accessor :root_path
    attr_accessor :app_name
    attr_accessor :timezone
    attr_accessor :per_page
    attr_accessor :per_page_steps
    attr_accessor :via_per_page
    attr_accessor :locale
    attr_accessor :currency
    attr_accessor :default_view_type
    attr_accessor :hide_resource_overview_component
    attr_accessor :hide_documentation_link
    attr_accessor :license
    attr_accessor :license_key
    attr_accessor :authorization_methods

    def initialize
      @root_path = '/avo'
      @app_name = Rails.application.class.to_s.split('::').first.underscore.humanize
      @timezone = 'UTC'
      @per_page = 24
      @per_page_steps = [12, 24, 48, 72]
      @via_per_page = 8
      @locale = 'us-US'
      @currency = 'USD'
      @default_view_type = :table
      @hide_resource_overview_component = false
      @hide_documentation_link = false
      @license = 'community'
      @license_key = nil
      @authorization_methods = {
        index: 'index?',
        show: 'show?',
        edit: 'edit?',
        new: 'new?',
        update: 'update?',
        create: 'create?',
        destroy: 'destroy?',
      }
    end
  end

  def self.configuration
    @configuration ||= Configuration.new
  end

  def self.configuration=(config)
    @configuration = config
  end

  def self.configure
    yield configuration
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
avo-0.3.2 lib/avo/configuration.rb
avo-0.3.1 lib/avo/configuration.rb