Module: Xqsr3::StringUtilities::QuoteIf
- Included in:
- String
- Defined in:
- lib/xqsr3/string_utilities/quote_if.rb
Defined Under Namespace
Modules: QuoteIf_Helper_
Class Method Summary collapse
-
.quote_if(s, **options) ⇒ Object
Converts a string to a quoted form if necessary.
Instance Method Summary collapse
Class Method Details
.quote_if(s, **options) ⇒ Object
Converts a string to a quoted form if necessary
Signature
-
Parameters:
-
*Required parameters*:
s- String
-
The string to be evaluated
-
*Options parameters*:
options- Hash
-
Options that control the behaviour of the
method
-
Options:
:quotes- String, Array
-
A string that is used as the opening
and closing quotes, or an array whose first two elements are used as the opening and closing quotes. Defaults to '"':quotables- String, Array, Regexp
-
A string representing the
quotable character, or an array containing the quotable characters, or a regular expression that determines by match whether the string should be quoted. Defaults to the regular expression /\s/
114 115 116 117 |
# File 'lib/xqsr3/string_utilities/quote_if.rb', line 114 def self.quote_if s, ** QuoteIf_Helper_.string_quote_if_array_ s, end |
Instance Method Details
#quote_if(**options) ⇒ Object
119 120 121 122 |
# File 'lib/xqsr3/string_utilities/quote_if.rb', line 119 def quote_if ** QuoteIf_Helper_.string_quote_if_array_ self, end |