lib/rom/sql/schema/attributes_inferrer.rb in rom-sql-3.1.0 vs lib/rom/sql/schema/attributes_inferrer.rb in rom-sql-3.2.0

- old
+ new

@@ -1,5 +1,7 @@ +# frozen_string_literal: true + require 'dry/core/class_attributes' module ROM module SQL class Schema < ROM::Schema @@ -20,12 +22,12 @@ def call(schema, gateway) dataset = schema.name.dataset columns = filter_columns(gateway.connection.schema(dataset)) - inferred = columns.map do |(name, definition)| - type = type_builder.(definition) + inferred = columns.map do |name, definition| + type = type_builder.(**definition) attr_class.new(type.meta(source: schema.name), name: name) if type end.compact missing = columns.map(&:first) - inferred.map { |attr| attr.name } @@ -40,10 +42,10 @@ self.class.new(options.merge(new_options)) end # @api private def filter_columns(schema) - schema.reject { |(_, definition)| definition[:db_type] == CONSTRAINT_DB_TYPE } + schema.reject { |_, definition| definition[:db_type] == CONSTRAINT_DB_TYPE } end end end end end