Sha256: 9793141fa608bfb91fd468cb244766d900a94a1ca97db6be3366e3d518617122
Contents?: true
Size: 575 Bytes
Versions: 1
Compression:
Stored size: 575 Bytes
Contents
module ActiveModel class Error attr_reader :messages def initialize(initial_msgs = {}) @messages = Hash.new { |h, k| h[k] = [] } initial_msgs.each { |attr, msgs| @messages[attr] = msgs.uniq } end def [](attribute) messages[attribute] end def delete(attribute) messages.delete(attribute) end def empty? messages.empty? end def clear @messages.clear end def add(attribute, message:) @messages[attribute] << message unless @messages[attribute].include? message end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hyper-mesh-1.0.0.lap28 | lib/reactive_record/active_record/error.rb |