Class: OneApm::Support::RenameRulesEngine::MatchExpression::Base
- Inherits:
-
Object
- Object
- OneApm::Support::RenameRulesEngine::MatchExpression::Base
- Defined in:
- lib/one_apm/support/rename_rules_engine/match_expression/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#is_not ⇒ Object
Returns the value of attribute is_not.
-
#match_value ⇒ Object
Returns the value of attribute match_value.
-
#operate ⇒ Object
Returns the value of attribute operate.
-
#state ⇒ Object
Returns the value of attribute state.
Instance Method Summary collapse
-
#initialize(expression) ⇒ Base
constructor
A new instance of Base.
- #match?(request) ⇒ Boolean
- #type_match?(type, expression, sample) ⇒ Boolean
Constructor Details
#initialize(expression) ⇒ Base
Returns a new instance of Base.
11 12 13 14 15 16 |
# 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 |
Instance Attribute Details
#is_not ⇒ Object
Returns the value of attribute is_not.
9 10 11 |
# File 'lib/one_apm/support/rename_rules_engine/match_expression/base.rb', line 9 def is_not @is_not end |
#match_value ⇒ Object
Returns the value of attribute match_value.
9 10 11 |
# File 'lib/one_apm/support/rename_rules_engine/match_expression/base.rb', line 9 def match_value @match_value end |
#operate ⇒ Object
Returns the value of attribute operate.
9 10 11 |
# File 'lib/one_apm/support/rename_rules_engine/match_expression/base.rb', line 9 def operate @operate end |
#state ⇒ Object
Returns the value of attribute state.
9 10 11 |
# File 'lib/one_apm/support/rename_rules_engine/match_expression/base.rb', line 9 def state @state end |
Instance Method Details
#match?(request) ⇒ Boolean
38 39 40 |
# File 'lib/one_apm/support/rename_rules_engine/match_expression/base.rb', line 38 def match?(request) false end |
#type_match?(type, expression, sample) ⇒ 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 |