module Fend::Plugins::ObjectValidation::ParamMethods

Public Instance Methods

attrs(*names) { |*values| ... } click to toggle source
# File lib/fend/plugins/object_validation.rb, line 42
def attrs(*names, &block)
  return if flat? && invalid?

  attrs = names.each_with_object({}) do |name, result|
    attr = _build_param(name, @value.public_send(name))
    result[name] = attr
  end

  yield(*attrs.values)

  attrs.each { |name, attr| _nest_errors(name, attr.errors) if attr.invalid? }
end