Class: NewRelic::Agent::RulesEngine
- Inherits:
-
Object
- Object
- NewRelic::Agent::RulesEngine
- Extended by:
- Forwardable
- Includes:
- Enumerable
- Defined in:
- lib/new_relic/agent/rules_engine.rb
Defined Under Namespace
Classes: Rule
Instance Attribute Summary collapse
-
#rules ⇒ Object
Returns the value of attribute rules.
Instance Method Summary collapse
-
#initialize(rules = []) ⇒ RulesEngine
constructor
A new instance of RulesEngine.
- #rename(original_string) ⇒ Object
Constructor Details
#initialize(rules = []) ⇒ RulesEngine
Returns a new instance of RulesEngine.
11 12 13 |
# File 'lib/new_relic/agent/rules_engine.rb', line 11 def initialize(rules=[]) @rules = rules end |
Instance Attribute Details
#rules ⇒ Object
Returns the value of attribute rules.
9 10 11 |
# File 'lib/new_relic/agent/rules_engine.rb', line 9 def rules @rules end |
Instance Method Details
#rename(original_string) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/new_relic/agent/rules_engine.rb', line 15 def rename(original_string) @rules.sort.inject(original_string) do |string,rule| if rule.each_segment result, matched = rule.map_to_list(string.split('/')) result = result.join('/') else result, matched = rule.apply(string) end break result if matched && rule.terminate_chain result end end |