Sha256: 02848e56a917d3fcbf5c699e65f0868030d9f8a5c99687e7fdf74495055c1e6d

Contents?: true

Size: 615 Bytes

Versions: 4

Compression:

Stored size: 615 Bytes

Contents

# frozen_string_literal: true

module Micro::Attributes
  module Features
    module Accept

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

        def __call_after_attributes_assign
          return unless attributes_errors?

          __raise_error_if_found_attributes_errors
        end

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

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
u-attributes-2.8.0 lib/micro/attributes/features/accept/strict.rb
u-attributes-2.7.0 lib/micro/attributes/features/accept/strict.rb
u-attributes-2.6.0 lib/micro/attributes/features/accept/strict.rb
u-attributes-2.5.0 lib/micro/attributes/features/accept/strict.rb