Class: Blacklight::Configuration::SortField

Inherits:
Field show all
Defined in:
lib/blacklight/configuration/sort_field.rb

Instance Method Summary collapse

Methods inherited from Field

#default_label

Methods inherited from OpenStructWithHashAccess

#deep_dup, #merge, #merge!, #select, #sort_by, #sort_by!, #to_h

Instance Method Details

#normalize!(blacklight_config = nil) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/blacklight/configuration/sort_field.rb', line 4

def normalize! blacklight_config = nil
  super
  self.field ||= self.label.try(:parameterize)
  self.field ||= self.sort

  self.sort ||= self.field

  self
end

#validate!Object

Raises:

  • (ArgumentError.new)


14
15
16
# File 'lib/blacklight/configuration/sort_field.rb', line 14

def validate!
  raise ArgumentError.new, "Must supply a sort string" if self.sort.nil?
end