Sha256: 86c4c075d5e00697766c72c91ec1c541a03ef04b3c1aaff9ff51f60aa0acae63
Contents?: true
Size: 637 Bytes
Versions: 23
Compression:
Stored size: 637 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
23 entries across 23 versions & 1 rubygems