Module: Xqsr3::StringUtilities::NilIfEmpty

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

Overview

include-able module that provides ::string_nil_if_empty and #nil_if_empty methods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.string_nil_if_empty(s) ⇒ Object

Returns nil if the given string is empty, 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_empty.rb', line 83

def self.string_nil_if_empty s

	NilIfEmpty_Helper_.string_nil_if_empty_array_ s
end

Instance Method Details

#nil_if_emptyObject

Returns nil if the instance is empty, otherwise returning self



89
90
91
92
# File 'lib/xqsr3/string_utilities/nil_if_empty.rb', line 89

def nil_if_empty

	NilIfEmpty_Helper_.string_nil_if_empty_array_ self
end