class String
A String
extension for ActsAsExplorable
Public Instance Methods
to_acts_as_explorable(*keys)
click to toggle source
Converts the String
into a Hash for ActsAsExplorable
.
Returns:¶ ↑
A Hash providing 2 keys:
-
:values
holds the search text values -
:params
holds parameters (fields) to search in
@example
query = "Foo Bar in:name,body sort:created_at-asc" query.to_acts_as_explorable # => {:values=>["Foo", "Bar"], :params=>{:in=>["name", "body"], :sort=>["created_at-asc"]}}
@param keys [Array<String, Symbol>, nil] Array of accepted keys
@return [Hash] Converted query
# File lib/acts_as_explorable/ext/string.rb, line 20 def to_acts_as_explorable(*keys) return nil if self.blank? ActsAsExplorable::Parser.transform(self, *keys) end