Module: Doing::StringQuery
- Included in:
- String
- Defined in:
- lib/doing/string/query.rb
Overview
Handling of search and regex strings
Instance Method Summary collapse
-
#ignore? ⇒ Boolean
Test if line should be ignored.
-
#ignore_case(search, case_type) ⇒ Boolean
Determine whether case should be ignored for string.
-
#rx? ⇒ Boolean
Determines if receiver is surrounded by slashes or starts with single quote.
-
#to_bool ⇒ Boolean
Returns a bool representation of the string.
-
#to_phrase_query ⇒ Object
Returns a phrase query (elastic search) representation of the object as a phrase parser.
-
#to_query ⇒ Object
Returns a query (elastic search) representation of the object as a boolean term parser.
-
#to_rx(distance: nil, case_type: nil) ⇒ Regexp
Convert string to fuzzy regex.
-
#truthy? ⇒ Boolean
Test string for truthiness (0, "f", "false", "n", "no" all return false, case insensitive, otherwise true).
-
#wildcard_to_rx ⇒ String
Convert ? and * wildcards to regular expressions.
Instance Method Details
#ignore? ⇒ Boolean
Test if line should be ignored
#ignore_case(search, case_type) ⇒ Boolean
Determine whether case should be ignored for string
#rx? ⇒ Boolean
Determines if receiver is surrounded by slashes or starts with single quote
#to_bool ⇒ Boolean
Returns a bool representation of the string.
#to_phrase_query ⇒ Object
Returns a phrase query (elastic search) representation of the object as a phrase parser.
#to_query ⇒ Object
Returns a query (elastic search) representation of the object as a boolean term parser.
#to_rx(distance: nil, case_type: nil) ⇒ Regexp
Convert string to fuzzy regex. Characters in words can be separated by up to distance characters in haystack, spaces indicate unlimited distance.
#truthy? ⇒ Boolean
Test string for truthiness (0, "f", "false", "n", "no" all return false, case insensitive, otherwise true)
#wildcard_to_rx ⇒ String
Convert ? and * wildcards to regular expressions. Uses \S (non-whitespace) instead of . (any character)