Sha256: 6839b0c31a290ce6fb50dff84ff6397d764b20394c214e5c1ce72339f5c15346
Contents?: true
Size: 501 Bytes
Versions: 3
Compression:
Stored size: 501 Bytes
Contents
module SplitIoClient class StartsWithMatcher def self.matcher_type 'STARTS_WITH'.freeze end def initialize(attribute, prefix_list) @attribute = attribute @prefix_list = prefix_list end def match?(_matching_key, _bucketing_key, _evaluator, data) value = data.fetch(@attribute) { |attr| data[attr.to_s] || data[attr.to_sym] } return false if @prefix_list.empty? @prefix_list.any? { |prefix| value.to_s.start_with? prefix } end end end
Version data entries
3 entries across 3 versions & 1 rubygems