class ProperProperties::Parsing::Normalizer::Rule

Describes a single normalization rule by replacing content

Public Class Methods

new(matcher, replacement = '') click to toggle source

Initializes a new rules base on a matching regexp and a replacement as substitution @param matcher [Regexp] @param replacement [String]

# File lib/proper_properties/parsing/normalizer.rb, line 29
def initialize(matcher, replacement = '')
  @matcher     = matcher
  @replacement = replacement
end

Public Instance Methods

apply!(text) click to toggle source

Apply the substitution to the text in place @param text [string] @return [String]

# File lib/proper_properties/parsing/normalizer.rb, line 37
def apply!(text)
  text.gsub!(@matcher, @replacement)
end