Module Pry::Helpers::CommandHelpers
In: lib/pry/helpers/command_helpers.rb

Methods

Included Modules

OptionsHelpers

Public Instance methods

convert a 1-index range to a 0-indexed one

Restrict a string to the given range of lines (1-indexed) @param [String] content The string. @param [Range, Fixnum] lines The line(s) to restrict it to. @return [String] The resulting string.

Return the syntax for a given editor for starting the editor and moving to a particular line within that file

Open a temp file and yield it to the block, closing it after @return [String] The path of the temp file

Remove any common leading whitespace from every line in `text`.

This can be used to make a HEREDOC line up with the left margin, without sacrificing the indentation level of the source code.

e.g.

  opt.banner unindent <<-USAGE
    Lorem ipsum dolor sit amet, consectetur adipisicing elit,
    sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
      "Ut enim ad minim veniam."
  USAGE

@param [String] The text from which to remove indentation @return [String], The text with indentation stripped.

@copyright Heavily based on textwrap.dedent from Python, which is:

  Copyright (C) 1999-2001 Gregory P. Ward.
  Copyright (C) 2002, 2003 Python Software Foundation.
  Written by Greg Ward <gward@python.net>

  Licensed under <http://docs.python.org/license.html>
  From <http://hg.python.org/cpython/file/6b9f0a6efaeb/Lib/textwrap.py>

[Validate]