Module: QAT::Configuration::Environment
- Included in:
- QAT::Configuration
- Defined in:
- lib/qat/configuration/environment.rb
Overview
Namespace for environment helper methods
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#each_environment {|Configuration| ... } ⇒ Object
Executes a code
block
in all environments of the current configuration directory. -
#environments ⇒ Array<String>
Returns all the defined environments in the configuration directory.
Instance Attribute Details
#directory ⇒ Object
5 6 7 |
# File 'lib/qat/configuration/environment.rb', line 5 def directory @directory end |
#environment ⇒ Object
5 6 7 |
# File 'lib/qat/configuration/environment.rb', line 5 def environment @environment end |
Instance Method Details
#each_environment {|Configuration| ... } ⇒ Object
Executes a code block
in all environments of the current configuration directory
74 75 76 77 78 79 80 81 82 |
# File 'lib/qat/configuration/environment.rb', line 74 def each_environment(&block) old_env = @environment environments.sort.each do |env| self.environment = env block.call(self) end ensure self.environment = old_env end |
#environments ⇒ Array<String>
Returns all the defined environments in the configuration directory
66 67 68 |
# File 'lib/qat/configuration/environment.rb', line 66 def environments Dir.glob(File.join directory, '*/').map { |entry| File.basename(entry) }.reject { |entry| entry == 'common' } end |