module Byebug::Helpers::StringHelper
Utilities for interaction with strings
Public Instance Methods
camelize(str)
click to toggle source
Converts str
from an_underscored-or-dasherized_string to
ACamelizedString.
# File lib/byebug/helpers/string.rb, line 11 def camelize(str) str.dup.split(/[_-]/).map(&:capitalize).join('') end
deindent(str, leading_spaces: 6)
click to toggle source
Removes a number of leading whitespace for each input line.
@note Might be unnecessary when Ruby 2.2 support is dropped and we can use squiggly heredoc's.
# File lib/byebug/helpers/string.rb, line 29 def deindent(str, leading_spaces: 6) str.gsub(/^ {#{leading_spaces}}/, '') end
prettify(str)
click to toggle source
Improves indentation and spacing in str
for readability in
Byebug's command prompt.
# File lib/byebug/helpers/string.rb, line 19 def prettify(str) "\n" + deindent(str) + "\n" end