class String

Public Instance Methods

indent(count, char = ' ') click to toggle source
# File lib/rspec_api_blueprint/string_extensions.rb, line 3
def indent(count, char = ' ')
  gsub(/([^\n]*)(\n|$)/) do |match|
    last_iteration = ($1 == "" && $2 == "")
    line = ""
    line << (char * count) unless last_iteration
    line << $1
    line << $2
    line
  end
end