Method: ALib::AbstractMain.unindent_block
- Defined in:
- lib/alib-0.5.0/main.rb
.unindent_block(buf) ⇒ Object
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
# File 'lib/alib-0.5.0/main.rb', line 197 def unindent_block buf #--{{{ buf = "#{ buf }" lines = buf.to_a indent_pat = %r/^\s*[\s|]/ indent = lines.first[ indent_pat ] rescue nil if indent lines.map do |line| line[ indent.size..-1 ] || "\n" end.join else buf end #--}}} end |