Class: ActiveModel::BetterErrors::HumanHashReporter

Inherits:
HashReporter show all
Defined in:
lib/active_model/better_errors/human_hash_reporter.rb

Overview

HumanHashReporter

Instance Attribute Summary

Attributes inherited from Reporter

#collection

Instance Method Summary collapse

Methods inherited from Reporter

#base, #initialize

Constructor Details

This class inherits a constructor from ActiveModel::BetterErrors::Reporter

Instance Method Details

#to_hashObject



9
10
11
12
13
14
15
16
17
# File 'lib/active_model/better_errors/human_hash_reporter.rb', line 9

def to_hash
  collection.to_hash.reduce({}) do |hash, kv|
    attribute, error_message_set = kv
    hash[attribute] = error_message_set.map do |error_message|
      ::ActiveModel::BetterErrors.format_message(base, error_message)
    end
    hash
  end
end