Sha256: 37331a30ac77d0ea10cd0f68a25e7a8ced632ba369b277c2b200e03af507c74f
Contents?: true
Size: 798 Bytes
Versions: 2
Compression:
Stored size: 798 Bytes
Contents
# frozen_string_literal: true module ElasticAPM class Config # @api private class WildcardPatternList # @api private class WildcardPattern def initialize(str) @pattern = convert(str) end def match?(other) !!@pattern.match(other) end alias :match :match? private def convert(str) parts = str.chars.each_with_object([]) do |char, arr| arr << (char == '*' ? '.*' : Regexp.escape(char)) end Regexp.new('\A' + parts.join + '\Z', Regexp::IGNORECASE) end end def call(value) value = value.is_a?(String) ? value.split(',') : Array(value) value.map(&WildcardPattern.method(:new)) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
elastic-apm-3.6.0 | lib/elastic_apm/config/wildcard_pattern_list.rb |
elastic-apm-3.5.0 | lib/elastic_apm/config/wildcard_pattern_list.rb |