Module: Xqsr3::StringUtilities::NilIfWhitespace

Included in:
String
Defined in:
lib/xqsr3/string_utilities/nil_if_whitespace.rb

Overview

include-able module that provides ::string_nil_if_whitespace and #nil_if_whitespace methods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.string_nil_if_whitespace(s) ⇒ Object

Returns nil if the given string is empty or contains only whitespace, otherwise returning the given string

Signature

  • Parameters:

  • *Required parameters*:

    • s (String) The string to be evaluated



83
84
85
86
# File 'lib/xqsr3/string_utilities/nil_if_whitespace.rb', line 83

def self.string_nil_if_whitespace s

	NilIfWhitespace_Helper_.string_nil_if_whitespace_array_ s
end

Instance Method Details

#nil_if_whitespaceObject

Returns nil if the instance is empty or contains only whitespace, otherwise returning self



90
91
92
93
# File 'lib/xqsr3/string_utilities/nil_if_whitespace.rb', line 90

def nil_if_whitespace

	NilIfWhitespace_Helper_.string_nil_if_whitespace_array_ self
end