Sha256: 9a4dc5ce3855b6c98634e262458f18ff81bd969d369168d10275957f8c558097
Contents?: true
Size: 853 Bytes
Versions: 12
Compression:
Stored size: 853 Bytes
Contents
# frozen_string_literal: true module Byebug module Helpers # # Utilities for interaction with strings # module StringHelper # # Converts +str+ from an_underscored-or-dasherized_string to # ACamelizedString. # def camelize(str) str.dup.split(/[_-]/).map(&:capitalize).join("") end # # Improves indentation and spacing in +str+ for readability in Byebug's # command prompt. # def prettify(str) "\n" + deindent(str) + "\n" end # # 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. # def deindent(str, leading_spaces: 6) str.gsub(/^ {#{leading_spaces}}/, "") end end end end
Version data entries
12 entries across 12 versions & 5 rubygems