Module: CircuitBreaker::Executors::DSL
Defined Under Namespace
Modules: ClassMethods
Classes: ConfigBuilder
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.included(base) ⇒ Object
4
5
6
|
# File 'lib/circuit_breaker/executors/dsl.rb', line 4
def self.included(base)
base.extend(ClassMethods)
end
|
Instance Method Details
#validate_parameters ⇒ Object
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
# File 'lib/circuit_breaker/executors/dsl.rb', line 56
def validate_parameters
config = self.class.get_config
parameters = config[:parameters]
parameters.each do |name, opts|
if opts[:required] && !@context.key?(name)
raise ArgumentError, "Missing required parameter: #{name}"
end
if @context.key?(name)
validate_parameter_type(name, @context[name], opts[:type]) if opts[:type]
elsif opts[:default]
@context[name] = opts[:default]
end
end
config[:validations].each do |validation|
instance_exec(@context, &validation)
end
end
|