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 12
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.

# File lib/byebug/helpers/string.rb, line 27
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 20
def prettify(str)
  "\n" + deindent(str) + "\n"
end