Class: ReeString::StripHeredoc

Inherits:
Object
  • Object
show all
Includes:
Ree::FnDSL
Defined in:
lib/ree_lib/packages/ree_string/package/ree_string/functions/strip_heredoc.rb

Instance Method Summary collapse

Instance Method Details

#call(string) ⇒ Object



27
28
29
30
31
# File 'lib/ree_lib/packages/ree_string/package/ree_string/functions/strip_heredoc.rb', line 27

def call(string)
  string.gsub(/^#{string.scan(/^[ \t]*(?=\S)/).min}/, "").tap do |stripped|
    stripped.freeze if frozen?
  end
end