Module: Xqsr3::StringUtilities::QuoteIf
- Included in:
- String
- Defined in:
- lib/xqsr3/string_utilities/quote_if.rb
Overview
include
-able module that provides ::quote_if and #quote_if methods
Class Method Summary collapse
-
.quote_if(s, **options) ⇒ Object
Converts a string to a quoted form if necessary.
Instance Method Summary collapse
-
#quote_if(**options) ⇒ Object
Converts the instance to a quoted form if necessary.
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/
-
109 110 111 112 |
# File 'lib/xqsr3/string_utilities/quote_if.rb', line 109 def self.quote_if s, ** QuoteIf_Helper_.string_quote_if_array_ s, end |
Instance Method Details
#quote_if(**options) ⇒ Object
Converts the instance to a quoted form if necessary
See Xqsr3::StringUtilities::QuoteIf::quite_if() for options
117 118 119 120 |
# File 'lib/xqsr3/string_utilities/quote_if.rb', line 117 def quote_if ** QuoteIf_Helper_.string_quote_if_array_ self, end |