class DomainModel::ModelErrors
Public Class Methods
new()
click to toggle source
# File lib/domain_model.rb, line 207 def initialize @hash = Hash.new end
Public Instance Methods
[](field_name)
click to toggle source
# File lib/domain_model.rb, line 220 def [](field_name) @hash[field_name] || [] end
add(field_name, error)
click to toggle source
# File lib/domain_model.rb, line 211 def add(field_name, error) errors = Array(error) return if errors.empty? @hash[field_name] ||= [] @hash[field_name] += Array(error) end
as_json(*)
click to toggle source
# File lib/domain_model.rb, line 236 def as_json(*) @hash.clone end
each(&block)
click to toggle source
# File lib/domain_model.rb, line 228 def each(&block) @hash.each(&block) end
empty?()
click to toggle source
# File lib/domain_model.rb, line 224 def empty? @hash.values.flatten.empty? end
fields()
click to toggle source
# File lib/domain_model.rb, line 232 def fields @hash.keys end
to_hash()
click to toggle source
# File lib/domain_model.rb, line 240 def to_hash @hash.clone end