Class: CabbageDoc::Configuration

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/cabbage_doc/configuration.rb

Constant Summary collapse

DEFAULTS =
{
  path: 'api/v1',
  title: 'Cabbage Doc',
  scheme: 'https',
  verbose: false,
  dev: false,
  visibility: [VISIBILITY.first],
  cache: Cache.new,
  request: proc { |request| request.perform },
  theme: 'github'
}.freeze
OPTIONAL_ATTRIBUTES =
i(welcome path scheme title verbose authentication dev request cache theme visibility).freeze
REQUIRED_ATTRIBUTES =
i(domain controllers root).freeze
ATTRIBUTES =
(OPTIONAL_ATTRIBUTES + REQUIRED_ATTRIBUTES).freeze
CALLABLE_ATTRIBUTES =
i(controllers authentication request).freeze

Instance Method Summary collapse

Methods included from Singleton

included

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



24
25
26
27
28
# File 'lib/cabbage_doc/configuration.rb', line 24

def initialize
  DEFAULTS.each do |attr, value|
    send(:"#{attr}=", value)
  end
end

Instance Method Details

#validate!Object



30
31
32
33
34
35
# File 'lib/cabbage_doc/configuration.rb', line 30

def validate!
  validate_required!
  validate_callable!
  validate_root!
  validate_visibility!
end