class OneApm::Support::RenameRulesEngine::MatchExpression::Base

Attributes

is_not[RW]
match_value[RW]
operate[RW]
state[RW]

Public Class Methods

new(expression) click to toggle source
# File lib/one_apm/support/rename_rules_engine/match_expression/base.rb, line 11
def initialize(expression)
  @is_not = expression[:is_not]
  @match_value = expression[:match_value]
  @operate = expression[:operate]
  @state = expression[:state]==0 ? true : false
end

Public Instance Methods

match?(request) click to toggle source
# File lib/one_apm/support/rename_rules_engine/match_expression/base.rb, line 38
def match?(request)
  false
end
type_match?(type, expression, sample) click to toggle source
# File lib/one_apm/support/rename_rules_engine/match_expression/base.rb, line 18
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