Method: DataModel::Error#add

Defined in:
lib/data_model/error.rb

#add(err, child: nil) ⇒ Object



64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/data_model/error.rb', line 64

def add(err, child: nil)
	if child.is_a?(Array)
		child = child.join(".").to_sym
	end

	if child == :base
		raise "child errors may not be named :base"
	end

	errs = child ? @children[child] ||= [] : @base
	errs.push(err)
end