Class: PrLog::Injector

Inherits:
Struct
  • Object
show all
Defined in:
lib/pr_log/injector.rb

Overview

Injects text into a file

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#destination_fileObject

Returns the value of attribute destination_file

Returns:

  • (Object)

    the current value of destination_file



3
4
5
# File 'lib/pr_log/injector.rb', line 3

def destination_file
  @destination_file
end

Instance Method Details

#insert_after(line, text) ⇒ Object



4
5
6
7
8
# File 'lib/pr_log/injector.rb', line 4

def insert_after(line, text)
  unless replace!(/#{line}/, '\0' + text)
    fail(InsertPointNotFound, "Insert point not found in #{destination_file}.")
  end
end