Module: SnippetCli::StringHelper
- Defined in:
- lib/snippet_cli/string_helper.rb
Overview
Utility methods for string manipulation.
Class Method Summary collapse
-
.ensure_trailing_newline(str) ⇒ Object
Returns str with a trailing newline, appending one if not already present.
Class Method Details
.ensure_trailing_newline(str) ⇒ Object
Returns str with a trailing newline, appending one if not already present.
7 8 9 |
# File 'lib/snippet_cli/string_helper.rb', line 7 def self.ensure_trailing_newline(str) str.end_with?("\n") ? str : "#{str}\n" end |