Class: JavaProperties::Parsing::Normalizer::Rule
- Inherits:
-
Object
- Object
- JavaProperties::Parsing::Normalizer::Rule
- Defined in:
- lib/java-properties/parsing/normalizer.rb
Overview
Describes a single normalization rule by replacing content
Instance Method Summary collapse
-
#apply!(text) ⇒ String
Apply the substitution to the text in place.
-
#initialize(matcher, replacement = '') ⇒ Rule
constructor
Initializes a new rules base on a matching regexp and a replacement as substitution.
Constructor Details
#initialize(matcher, replacement = '') ⇒ Rule
Initializes a new rules base on a matching regexp and a replacement as substitution
29 30 31 32 |
# File 'lib/java-properties/parsing/normalizer.rb', line 29 def initialize(matcher, replacement = '') @matcher = matcher @replacement = replacement end |
Instance Method Details
#apply!(text) ⇒ String
Apply the substitution to the text in place
37 38 39 |
# File 'lib/java-properties/parsing/normalizer.rb', line 37 def apply!(text) text.gsub!(@matcher, @replacement) end |