<commit_before>require 'stockboy/translator'

module Stockboy::Translations
  class Date < Stockboy::Translator

    def translate(context)
      value = field_value(context, field_key)
      return nil if value.blank?

      case value
      when String then ::Date.parse(value)
      when ::Time, ::DateTime then ::Date.new(value.year, value.month, value.day)
      when ::Date then value
      else nil
      end
    end

  end
end<commit_msg>Fix Date for ensuring String uses base class<commit_after>require 'stockboy/translator'

module Stockboy::Translations
  class Date < Stockboy::Translator

    def translate(context)
      value = field_value(context, field_key)
      return nil if value.blank?

      case value
      when ::String then ::Date.parse(value)
      when ::Time, ::DateTime then ::Date.new(value.year, value.month, value.day)
      when ::Date then value
      else nil
      end
    end

  end
end
{'fraction_non_alphanumeric': 0.09081081081081081, 'fraction_numerical': 0.0, 'mean_word_length': 3.026086956521739, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5755116', 'n_tokens_mistral': 275, 'n_tokens_neox': 268, 'n_words': 84}