Method: String#indent
- Defined in:
- lib/rc/core_ext/string.rb
#indent(n, c = ' ') ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/rc/core_ext/string.rb', line 11 def indent(n, c=' ') if n >= 0 gsub(/^/, c * n) else gsub(/^#{Regexp.escape(c)}{0,#{-n}}/, "") end end |