Class: Search::Sort

Inherits:
Object
  • Object
show all
Defined in:
lib/acts_as_ferret/ferret_extensions.rb

Overview

add marshalling support to Sort

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

._load(string) ⇒ Object



177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/acts_as_ferret/ferret_extensions.rb', line 177

def self._load(string)
  # we exclude the last <DOC> sorting as it is appended by new anyway
  if string =~ /^Sort\[(.*?)(<DOC>(!)?)?\]$/
    sort_fields = $1.split(',').map do |value| 
    value.strip!
      Ferret::Search::SortField._load value unless value.blank?
    end
    new sort_fields.compact
  else
    raise "invalid value: #{string}"
  end
end

Instance Method Details

#_dump(depth) ⇒ Object



173
174
175
# File 'lib/acts_as_ferret/ferret_extensions.rb', line 173

def _dump(depth)
  to_s
end