module Chewy::Search::Parameters::StringArrayStorage

Stores value as an array of strings.

Public Instance Methods

update!(other_value) click to toggle source

Unions two arrays.

@see Chewy::Search::Parameters::Storage#update! @param other_value [String, Symbol, Array<String, Symbol>] any acceptable storage value @return [Array<String, Symbol>] updated value

# File lib/chewy/search/parameters/concerns/string_array_storage.rb, line 11
def update!(other_value)
  @value = value | normalize(other_value)
end

Private Instance Methods

normalize(value) click to toggle source
# File lib/chewy/search/parameters/concerns/string_array_storage.rb, line 17
def normalize(value)
  Array.wrap(value).flatten(1).map(&:to_s).reject(&:blank?)
end