Sha256: 92e4ab0abc6b134830df87820df9c0ef56cd3ed6f984ed49c9831315ab031580
Contents?: true
Size: 488 Bytes
Versions: 5
Compression:
Stored size: 488 Bytes
Contents
module Pione module Util module Indentation # Cut indentations of the text. This function cuts indentation of all lines # with the depth of first line's indentation. # # @param text [String] # the text # @return [String] # indentation cutted text def self.cut(text) line = text.lines.to_a.first n = line.length - line.lstrip.length n > 0 ? text.gsub(/^\s{0,#{n}}/m, "") : text end end end end
Version data entries
5 entries across 5 versions & 1 rubygems