Method: Main::Util::Methods#unindent
- Defined in:
- lib/main/util.rb
#unindent(chunk) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/main/util.rb', line 31 def unindent chunk lines = chunk.split %r/\n/ indent = nil re = %r/^/ lines.map! do |line| unless indent indent = line[%r/^\s*/] re = %r/^#{ indent }/ end line.gsub re, '' end.join("\n") end |