Class: TraceViz::Config::Validator

Inherits:
Object
  • Object
show all
Defined in:
lib/trace_viz/config/validator.rb

Constant Summary collapse

FILTER_KEYS =
Collectors::Filters::Registry::FILTERS.keys.freeze

Instance Method Summary collapse

Constructor Details

#initializeValidator

Returns a new instance of Validator.



10
11
12
13
14
15
16
17
18
# File 'lib/trace_viz/config/validator.rb', line 10

def initialize
  @validations = {
    params: ->(value) { validate_params(value) },
    result: ->(value) { validate_result(value) },
    source_location: ->(value) { validate_source_location(value) },
    filters: ->(value) { validate_filters(value) },
    export: ->(value) { validate_export(value) },
  }
end

Instance Method Details

#validate(group, value) ⇒ Object



20
21
22
23
24
# File 'lib/trace_viz/config/validator.rb', line 20

def validate(group, value)
  return unless @validations.key?(group)

  @validations[group].call(value)
end