Method: Hanami::Utils::Files.inject_line_after

Defined in:
lib/hanami/utils/files.rb

.inject_line_after(path, target, contents) ⇒ Object

Inject ‘contents` in `path` after `target`.

Parameters:

  • path (String, Pathname)

    the path to file

  • target (String, Regexp)

    the target to replace

  • contents (String)

    the contents to inject

Raises:

  • (Errno::ENOENT)

    if the path doesn’t exist

  • (ArgumentError)

    if ‘target` cannot be found in `path`

See Also:

Since:

  • 1.1.0

[View source]

244
245
246
# File 'lib/hanami/utils/files.rb', line 244

def self.inject_line_after(path, target, contents)
  _inject_line_after(path, target, contents, method(:index))
end