Sha256: 668c091a8c8f150b4997137bc417e77d13a98e49880dfad2640d62d9b54a0c35
Contents?: true
Size: 589 Bytes
Versions: 2
Compression:
Stored size: 589 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 def none? @errors.none? end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
valcro-0.2.0 | lib/valcro/error_list.rb |
valcro-0.1.1 | lib/valcro/error_list.rb |