# frozen_string_literal: true module Aspecto # Aspecto OpenTelemetry Distro module OpenTelemetry # Sampling logic for aspecto otel distribution module Sampler extend self def meets_operator?(operator, expected, actual) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity expected_lower = expected&.downcase actual_lower = actual&.downcase case operator when :eq expected_lower == actual_lower when :ne expected_lower != actual_lower when :starts_with actual_lower.start_with?(expected_lower) when :ends_with actual_lower.end_with?(expected_lower) when :contains actual_lower.include?(expected_lower) when :not_contains !actual_lower.include?(expected_lower) when :matches Regexp.new(expected_lower).match(actual_lower) when :defined !actual.nil? when :undefined actual.nil? when :any true else false end end end end end