Class: Configuration
- Inherits:
-
Object
- Object
- Configuration
- Defined in:
- lib/configuration.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
-
#[](key) ⇒ Object
Allow straight hash access to the options.
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
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
#options ⇒ Object
Returns the value of attribute options.
5 6 7 |
# File 'lib/configuration.rb', line 5 def @options end |
Class Method Details
.load ⇒ Object
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 |