Class: Configuration

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



15
16
17
18
19
20
# File 'lib/configuration.rb', line 15

def initialize
  config_file = File.join('doc', 'api_doc.yml')
  Rails.logger.info("Loading EasyApiDoc configuration file #{config_file}")

  @options = YAML.load(File.read(config_file))
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



5
6
7
# File 'lib/configuration.rb', line 5

def options
  @options
end

Class Method Details

.loadObject



7
8
9
10
11
12
13
# File 'lib/configuration.rb', line 7

def self.load
  if Rails.env.development?
    Configuration.new
  else
    @@config ||= Configuration.new
  end
end

Instance Method Details

#[](key) ⇒ Object

Allow straight hash access to the options



23
24
25
# File 'lib/configuration.rb', line 23

def [](key)
  @options[key]
end