class Environmentor::Attribute::ValidationError
Attributes
attr[R]
Public Class Methods
new(attr, mappers, opts, message: "Validation error")
click to toggle source
# File lib/environmentor/attribute.rb, line 10 def initialize(attr, mappers, opts, message: "Validation error") @attr = attr @mappers = mappers @opts = opts @message = message end
Public Instance Methods
message(msg = nil)
click to toggle source
# File lib/environmentor/attribute.rb, line 17 def message(msg = nil) decorate_msg(msg || @message) end
Protected Instance Methods
decorate_msg(msg)
click to toggle source
# File lib/environmentor/attribute.rb, line 29 def decorate_msg(msg) msg << " for #{@attr.full_name}" msg << ", “#{@attr.description}”" if @attr.description msg << " (looked in " << @mappers.map { |m| opts = m.class.opts_from_mappers_hash(@opts) "#{m.human_attr_location(@attr, **opts)} in #{m.human_description}" }.join(', ') << ")" end