Sha256: 055404c0fac9daf623b62d4f0642cfabc8d5e070982d14da89f7bce84cdb9d46

Contents?: true

Size: 1.17 KB

Versions: 3

Compression:

Stored size: 1.17 KB

Contents

# encoding: utf-8

module OneApm
  module Support
    class RenameRulesEngine
      module MatchExpression

        class Base
          attr_accessor :is_not, :match_value, :operate, :state

          def initialize(expression)
            @is_not = expression[:is_not]
            @match_value = expression[:match_value]
            @operate = expression[:operate]
            @state = expression[:state]==0 ? true : false
          end

          def type_match?(type, expression, sample)
            case type
              when 'equals'
                sample.eql?(expression)
              when 'endwith'
                sample.end_with?(expression)
              when 'startswith'
                sample.start_with?(expression)
              when 'contains'
                sample.include?(expression)
              when 'in'
                expression = expression.split(',')
                expression.include?(sample)
              when 'existence', 'isnotempty'
                !(sample.nil? || sample.to_s.empty?)
              else
                false
            end
          end

          def match?(request)
            false
          end

        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
oneapm_rpm-1.4.2 lib/one_apm/support/rename_rules_engine/match_expression/base.rb
oneapm_rpm-1.4.1 lib/one_apm/support/rename_rules_engine/match_expression/base.rb
oneapm_rpm-1.4.0 lib/one_apm/support/rename_rules_engine/match_expression/base.rb