Module: BlacklightRangeLimit

Defined in:
lib/blacklight_range_limit.rb,
lib/blacklight_range_limit/engine.rb,
lib/blacklight_range_limit/routes.rb,
lib/blacklight_range_limit/version.rb,
lib/blacklight_range_limit/route_sets.rb,
lib/blacklight_range_limit/controller_override.rb,
lib/blacklight_range_limit/range_limit_builder.rb,
lib/blacklight_range_limit/segment_calculation.rb,
lib/blacklight_range_limit/routes/range_searchable.rb,
lib/generators/blacklight_range_limit/assets_generator.rb,
lib/generators/blacklight_range_limit/install_generator.rb

Overview

Meant to be in a Controller, included in our ControllerOverride module.

Defined Under Namespace

Modules: ControllerOverride, RangeLimitBuilder, RouteSets, Routes, SegmentCalculation, ViewHelperOverride Classes: AssetsGenerator, Engine, InstallGenerator, InvalidRange

Constant Summary collapse

VERSION =
self.version

Class Method Summary collapse

Class Method Details

.range_config(blacklight_config, solr_field) ⇒ Object

Convenience method for returning range config hash from blacklight config, for a specific solr field, in a normalized way.

Returns false if range limiting not configured. Returns hash even if configured to 'true' for consistency.


35
36
37
38
39
40
41
42
43
44
# File 'lib/blacklight_range_limit.rb', line 35

def self.range_config(blacklight_config, solr_field)
  field = blacklight_config.facet_fields[solr_field.to_s]

  return false unless field && field.range

  config = field.range
  config = { partial: field.partial } if config === true

  config
end

.safe_arr_add(array, element) ⇒ Object

Add element to array only if it's not already there


24
25
26
# File 'lib/blacklight_range_limit.rb', line 24

def self.safe_arr_add(array, element)
  array << element unless array.include?(element)
end

.versionObject


3
4
5
# File 'lib/blacklight_range_limit/version.rb', line 3

def self.version
  @version ||= File.read(File.join(File.dirname(__FILE__), '..', '..', 'VERSION')).chomp
end