Class: ScoobySnacks::SolrBehavior::Solr::Date
- Inherits:
-
Object
- Object
- ScoobySnacks::SolrBehavior::Solr::Date
- Defined in:
- lib/scooby_snacks/solr_behavior.rb
Class Method Summary collapse
Class Method Details
.coerce(inputs) ⇒ Date
43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/scooby_snacks/solr_behavior.rb', line 43 def self.coerce(inputs) ::Array.wrap(inputs).reject{|input| input.blank?}.map do |input| field = String.coerce(input) begin if (field.to_i.to_s == field) && (field.to_i < 3000) ::Date.new(field.to_i) else ::Date.parse(field) end rescue ArgumentError Rails.logger.info "Unable to parse date: #{field.inspect}" end end end |