module Gemmy::Patches::StringPatch::InstanceMethods::Indent

Public Instance Methods

indent(n, c=' ') click to toggle source

facets

# File lib/gemmy/patches/string_patch.rb, line 192
def indent(n, c=' ')
  if n >= 0
    gsub(/^/, c * n)
  else
    gsub(/^#{Regexp.escape(c)}{0,#{-n}}/, "")
  end
end