Sha256: 844e738ba984f4b1735ca5227d80bcea3298d935a97acb321d0b0898586e60b7
Contents?: true
Size: 601 Bytes
Versions: 14
Compression:
Stored size: 601 Bytes
Contents
# frozen_string_literal: true module SteppedService class Errors < Hash def add(key, value, _opts = {}) self[key] ||= [] self[key] << value self[key].uniq! end def add_from_hash(errors_hash) errors_hash.each do |key, values| values.each { |value| add key, value } end end def full_messages f_msgs = [] each_one { |field, message| f_msgs << "#{field}: #{message}" } f_msgs end def each_one each_pair do |field, messages| messages.each { |message| yield field, message } end end end end
Version data entries
14 entries across 14 versions & 1 rubygems