Class: String
- Defined in:
- lib/nutella/core_ext/object/blank.rb,
lib/nutella/core_ext/string/colour.rb,
lib/nutella/core_ext/string/aliases.rb,
lib/nutella/core_ext/string/exclude.rb,
lib/nutella/core_ext/string/heredoc.rb
Overview
:nodoc:
Instance Method Summary collapse
- #blank? ⇒ Boolean
-
#exclude?(str) ⇒ Boolean
(also: #excludes?)
The inverse of
String#include?
. -
#heredoc ⇒ String
(also: #format_heredoc, #strip_heredoc)
Left-aligns a heredoc by finding the least indented line in the string, and removing that amount of leading whitespace from each line.
Instance Method Details
#blank? ⇒ Boolean
39 40 41 |
# File 'lib/nutella/core_ext/object/blank.rb', line 39 def blank? self !~ /[^\s]/ end |
#exclude?(str) ⇒ Boolean Also known as: excludes?
The inverse of String#include?
.
6 7 8 |
# File 'lib/nutella/core_ext/string/exclude.rb', line 6 def exclude?(str) !include? str end |
#heredoc ⇒ String Also known as: format_heredoc, strip_heredoc
Left-aligns a heredoc by finding the least indented line in the string, and removing that amount of leading whitespace from each line.
15 16 17 |
# File 'lib/nutella/core_ext/string/heredoc.rb', line 15 def heredoc gsub /^[ \t]{#{scan(/^[ \t]*(?=\S)/).min.size}}/, "" end |