Module: Micro::Attributes::Features::Accept::Strict

Defined in:
lib/micro/attributes/features/accept/strict.rb

Constant Summary collapse

ATTRIBUTES_REJECTED =
"One or more attributes were rejected. Errors:\n".freeze

Instance Method Summary collapse

Instance Method Details

#__call_after_attributes_assignObject



10
11
12
13
14
# File 'lib/micro/attributes/features/accept/strict.rb', line 10

def __call_after_attributes_assign
  return unless attributes_errors?

  __raise_error_if_found_attributes_errors
end

#__raise_error_if_found_attributes_errorsObject

Raises:

  • (ArgumentError)


16
17
18
19
20
21
# File 'lib/micro/attributes/features/accept/strict.rb', line 16

def __raise_error_if_found_attributes_errors
  raise ArgumentError, [
    ATTRIBUTES_REJECTED,
    attributes_errors.map { |key, msg| "* #{key.inspect} #{msg}" }.join("\n")
  ].join
end