lib/hanami/model/configuration.rb in hanami-model-1.3.2 vs lib/hanami/model/configuration.rb in hanami-model-1.3.3

- old
+ new

@@ -1,7 +1,9 @@ -require 'rom/configuration' +# frozen_string_literal: true +require "rom/configuration" + module Hanami module Model # Configuration for the framework, models and adapters. # # Hanami::Model has its own global configuration that can be manipulated @@ -28,17 +30,17 @@ # @since 0.2.0 # @api private def initialize(configurator) @backend = configurator.backend @url = configurator.url - @migrations = configurator._migrations - @schema = configurator._schema - @gateway_config = configurator._gateway - @logger = configurator._logger + @migrations = configurator._migrations + @schema = configurator._schema + @gateway_config = configurator._gateway + @logger = configurator._logger @migrations_logger = configurator.migrations_logger - @mappings = {} - @entities = {} + @mappings = {} + @entities = {} end # NOTE: This must be changed when we want to support several adapters at the time # # @since 0.7.0 @@ -134,32 +136,32 @@ # # @since 1.0.0 # @api private def rom @rom ||= ROM::Configuration.new(@backend, @url, infer_relations: false) - rescue => e - raise UnknownDatabaseAdapterError.new(@url) if e.message =~ /adapters/ + rescue => exception + raise UnknownDatabaseAdapterError.new(@url) if exception.message =~ /adapters/ - raise e + raise exception end # @raise [Hanami::Model::UnknownDatabaseAdapterError] if `url` is blank, # or it uses an unknown adapter. # # @since 1.0.0 # @api private - def load!(repositories, &blk) # rubocop:disable Metrics/AbcSize + def load!(repositories, &blk) rom.setup.auto_registration(config.directory.to_s) unless config.directory.nil? rom.instance_eval(&blk) if block_given? configure_gateway repositories.each(&:load!) self.logger = logger container = ROM.container(rom) define_entities_mappings(container, repositories) container - rescue => e - raise Hanami::Model::Error.for(e) + rescue => exception + raise Hanami::Model::Error.for(exception) end # @since 1.0.0 # @api private def method_missing(method_name, *args, &blk)