Module: EnvControl
- Defined in:
- lib/env_control.rb,
lib/env_control/errors.rb,
lib/env_control/version.rb,
lib/env_control/validators.rb,
lib/env_control/configuration.rb,
lib/env_control/validate_env_contract.rb,
lib/env_control/validate_env_variable.rb,
lib/env_control/validate_env_variables.rb,
lib/env_control/get_environment_specific_contract.rb
Defined Under Namespace
Modules: Validators
Classes: BreachOfContractError, Configuration, EnvironmentNameNotConfiguredError, Error, GetEnvironmentSpecificContract, NonStringEnvironmentNameError, NonSymbolicKeyError, ValidateEnvContract, ValidateEnvVariable, ValidateEnvVariables, WrongValueError
Constant Summary
collapse
- VERSION =
"0.1.0"
Class Method Summary
collapse
Class Method Details
.configuration {|Configuration.instance| ... } ⇒ Object
20
21
22
23
|
# File 'lib/env_control.rb', line 20
def self.configuration
yield Configuration.instance if block_given?
Configuration.instance
end
|
.validate(env, contract: configuration.contract, environment_name: configuration.environment_name, on_error: configuration.on_validation_error) ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/env_control.rb', line 25
def self.validate(
env,
contract: configuration.contract,
environment_name: configuration.environment_name,
on_error: configuration.on_validation_error
)
ValidateEnvContract.new.call(contract: contract)
ValidateEnvVariables.new.call(env: env, contract: contract, environment_name: environment_name).tap do |report|
return on_error.call(report) if on_error && report.any?
end
end
|