<commit_before>require "lotus/validations"

# Implements ::validates and friends, and #valid?.
module Reform::Form::Lotus
  class Errors < Lotus::Validations::Errors
    def merge!(errors, prefix)
      errors.instance_variable_get(:@errors).each do |name, err|
        field = (prefix+[name]).join(".")
        add(field, *err) # TODO: use namespace feature in Lotus here!
      end
      #   next if messages[field] and messages[field].include?(msg)
    end

    def inspect
      @errors.to_s
    end

    def messages
      self<commit_msg>fix lotus.<commit_after>require "lotus/validations"

# Implements ::validates and friends, and #valid?.
module Reform::Form::Lotus
  class Errors < Lotus::Validations::Errors
    def merge!(errors, prefix)
      new_errors = {}
      errors.instance_variable_get(:@errors).each do |name, err|
        field = (prefix+[name]).join(".")
        new_errors[field] = err
      end
      #   next if messages[field] and messages[field].include?(msg)

      new_errors.each { |field, err| add(field, *err) } # TODO: use namespace feature in Lotus here!
    end

    def inspect
      @errors.to_s
    end

    def messages
      self
{'fraction_non_alphanumeric': 0.12211784799316823, 'fraction_numerical': 0.0, 'mean_word_length': 3.0694444444444446, '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': '2098550', 'n_tokens_mistral': 363, 'n_tokens_neox': 357, 'n_words': 96}