Sha256: 09163062dc339c64e08503d90077b2d973c9996c239df5fbd811989cc862883d
Contents?: true
Size: 418 Bytes
Versions: 1
Compression:
Stored size: 418 Bytes
Contents
module PGit module Helpers module Heredoc def self.remove_front_spaces(string) space_lengths = string.split("\n").select do |s| s.match(/\S/) end.map {|s| s.scan(/^\s*/).first.length } min_length = space_lengths.inject(100) do |accum, value| accum > value ? value : accum end string.gsub!(/^\s{#{min_length}}/, '') end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pgit-1.0.0 | lib/pgit/helpers/heredoc.rb |