Module: Gemmy::Patches::StringPatch::InstanceMethods::Indent
- Defined in:
- lib/gemmy/patches/string_patch.rb
Instance Method Summary collapse
-
#indent(n, c = ' ') ⇒ Object
facets.
Instance Method Details
#indent(n, c = ' ') ⇒ Object
facets
192 193 194 195 196 197 198 |
# 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 |