| Module | Pry::Helpers::CommandHelpers |
| In: |
lib/pry/helpers/command_helpers.rb
|
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.
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
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>
@param [String] text The text from which to remove indentation @return [String] The text with indentation stripped.