Sha256: 9c2283d29382ddbbbfc654e047a35449100c74333358568ac0a7da74decd90ea
Contents?: true
Size: 546 Bytes
Versions: 2
Compression:
Stored size: 546 Bytes
Contents
module Valcro class ErrorList attr_accessor :errors def initialize @errors = [] end def <<(error) @errors << error end def add(prop, message) @errors << Valcro::Error.new(prop, message) end def [](prop) @errors.select { |error| error.property == prop }.map(&:message) || [] end def clear! @errors = [] end def full_messages @errors.map(&:to_s) end def to_s full_messages.join(' ') end def any? @errors.any? end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
valcro-0.1 | lib/valcro/error_list.rb |
valcro-0.0.2 | lib/valcro/error_list.rb |