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
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/
112 113 114 115 |
# File 'lib/xqsr3/string_utilities/quote_if.rb', line 112 def self.quote_if s, ** QuoteIf_Helper_.string_quote_if_array_ s, end |
Instance Method Details
#quote_if(**options) ⇒ Object
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 |