def apply(files, options = {})
      offset = options[:offset] || 0
      files = [files] if files.kind_of? String

      safe_level = options[:safe_level] || PatternPatch.safe_level
      trim_mode = options[:trim_mode] || PatternPatch.trim_mode

      patch_text = ERB.new(text, safe_level, trim_mode).result options[:binding]

      files.each do |path|
        modified = Utilities.apply_patch File.read(path),
                                         regexp,
                                         patch_text,
                                         global,
                                         mode,
                                         offset
        File.write path, modified
      end
    end
def apply(files, options = {})
      offset = options[:offset] || 0
      files = [files] if files.kind_of? String

      safe_level = options[:safe_level] || PatternPatch.safe_level
      trim_mode = options[:trim_mode] || PatternPatch.trim_mode

      patch_text = ERB.new(text, safe_level, trim_mode).result options[:binding]

      files.each do |path|
        modified = Utilities.apply_patch File.read(path),
                                         regexp,
                                         patch_text,
                                         global,
                                         mode,
                                         offset
        File.write path, modified
      end
    end
Applies the patch to one or more files. ERB is processed in the text
 field, whether it comes from a text_file or not. Pass a Binding to
 ERB using the :binding option. Pass the :offset option to specify a
 starting offset, in characters, from the beginning of the file.

 @param files [Array, String] One or more file paths to which to apply the patch.
 @param options [Hash] Options for applying the patch.
 @option options [Binding] :binding (nil) A Binding object to use when rendering ERB
 @option options [Integer] :offset (0) Offset in characters
 @option options [Object, nil] :safe_level (PatternPatch.safe_level) A valid value for $SAFE for use with ERb
 @option options [String] :trim_mode (PatternPatch.trim_mode) A valid ERb trim mode
 @raise [ArgumentError] In case of invalid mode (other than :append, :prepend, :replace)