lib/hanami/entity/schema.rb in hanami-model-1.3.2 vs lib/hanami/entity/schema.rb in hanami-model-1.3.3

- old
+ new

@@ -1,8 +1,10 @@ -require 'hanami/model/types' -require 'hanami/utils/hash' +# frozen_string_literal: true +require "hanami/model/types" +require "hanami/utils/hash" + module Hanami class Entity # Entity schema is a definition of a set of typed attributes. # # @since 0.7.0 @@ -180,14 +182,14 @@ # # @since 0.7.0 # @api private def call(attributes) schema.call(attributes) - rescue Dry::Types::SchemaError => e - raise TypeError.new(e.message) - rescue Dry::Types::MissingKeyError, Dry::Types::UnknownKeysError => e - raise ArgumentError.new(e.message) + rescue Dry::Types::SchemaError => exception + raise TypeError.new(exception.message) + rescue Dry::Types::MissingKeyError, Dry::Types::UnknownKeysError => exception + raise ArgumentError.new(exception.message) end # Check if the attribute is known # # @param name [Symbol] the attribute name @@ -241,10 +243,10 @@ ) end # @since 0.7.0 # @api private - alias [] call + alias_method :[], :call # Check if the attribute is known # # @param name [Symbol] the attribute name #