Method: OneApm::Support::RenameRulesEngine::MatchExpression::Base#type_match?

Defined in:
lib/one_apm/support/rename_rules_engine/match_expression/base.rb

#type_match?(type, expression, sample) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# 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