Sha256: 6a810a07c00963e7d533fbee335956d27299166f103f59fd477e5c980e3bfb53
Contents?: true
Size: 638 Bytes
Versions: 41
Compression:
Stored size: 638 Bytes
Contents
# frozen_string_literal: true module Blacklight # These are data types that blacklight can use to coerce values from the index module Types class Array def self.coerce(input) ::Array.wrap(input) end end class String def self.coerce(input) ::Array.wrap(input).first end end class Date def self.coerce(input) field = String.coerce(input) return if field.blank? begin ::Date.parse(field) rescue ArgumentError Rails.logger&.info "Unable to parse date: #{field.first.inspect}" end end end end end
Version data entries
41 entries across 41 versions & 1 rubygems