Module: Padrino::Configuration
- Included in:
- Padrino
- Defined in:
- padrino-core/lib/padrino-core/configuration.rb
Overview
Padrino simple configuration module
Instance Method Summary collapse
-
#config ⇒ Object
Returns the configuration structure allowing to get and set it’s values.
-
#configure(*environments) {|config| ... } ⇒ Object
Allows to configure different environments differently.
Instance Method Details
#config ⇒ Object
17 18 19 |
# File 'padrino-core/lib/padrino-core/configuration.rb', line 17 def config @config ||= OpenStruct.new end |
#configure(*environments) {|config| ... } ⇒ Object
Allows to configure different environments differently. Requires a block.
Example:
Padrino.configure :development do |config|
config.value2 = 'only development'
end
Padrino.configure :development, :production do |config|
config.value2 = 'both development and production'
end
Padrino.configure do |config|
config.value2 = 'any environment'
end
36 37 38 |
# File 'padrino-core/lib/padrino-core/configuration.rb', line 36 def configure(*environments) yield(config) if environments.empty? || environments.include?(Padrino.env) end |