Sha256: cf887a9d7645a9bdc4d55c922e43ab3fa33bae6cc18c474edbc2aa0d1be94208
Contents?: true
Size: 575 Bytes
Versions: 16
Compression:
Stored size: 575 Bytes
Contents
# frozen_string_literal: true module DeepCover module Tools::StripHeredoc # In-place implementation copied from active-support. IMPLEMENTATION = -> do gsub(/^#{scan(/^[ \t]*(?=\S)/).min}/, ''.freeze).tap do |stripped| stripped.freeze if frozen? end end # Same as #strip_heredoc from active-support # https://github.com/rails/rails/blob/16574409f813e2197f88e4a06b527618d64d9ff0/activesupport/lib/active_support/core_ext/string/strip.rb#L22 def strip_heredoc(string) string.instance_exec(&IMPLEMENTATION) end end end
Version data entries
16 entries across 16 versions & 2 rubygems