class R10K::Settings::Collection::ValidationError
Attributes
errors[R]
Public Class Methods
new(mesg, options = {})
click to toggle source
Calls superclass method
R10K::Error.new
# File lib/r10k/settings/collection.rb, line 85 def initialize(mesg, options = {}) super @errors = options[:errors] end
Public Instance Methods
format()
click to toggle source
# File lib/r10k/settings/collection.rb, line 90 def format struct = [] struct << "#{message}:" @errors.each_pair do |name, nested| struct << indent(structure_exception(name, nested)) end struct.join("\n") end
Private Instance Methods
indent(str, level = 4)
click to toggle source
# File lib/r10k/settings/collection.rb, line 112 def indent(str, level = 4) prefix = ' ' * level str.gsub(/^/, prefix) end
structure_exception(name, exc)
click to toggle source
# File lib/r10k/settings/collection.rb, line 101 def structure_exception(name, exc) struct = [] struct << "#{name}:" if exc.is_a? ValidationError struct << indent(exc.format) else struct << indent(exc.message) end struct.join("\n") end