app/importers/concerns/importer_dsl.rb in importo-2.0.5 vs app/importers/concerns/importer_dsl.rb in importo-3.0.9

- old
+ new

@@ -1,8 +1,8 @@ # frozen_string_literal: true -require 'active_support/concern' +require "active_support/concern" module ImporterDsl extend ActiveSupport::Concern included do @@ -29,22 +29,14 @@ # # Adds a column definition # # @param [Object] args # @param [Object] block which will filter the results before storing the value in the attribute, this is useful for lookups or reformatting - def column(*args, &block) - options = args.extract_options! - - name = args[0] - name ||= options[:name] - name ||= options[:attribute] - - hint = args[1] - hint ||= options[:hint] - - options[:scope] = self.name.underscore.to_s.tr('/', '.').to_sym - - columns[name] = Importo::ImportColumn.new(name, hint, options[:explanation], options, &block) + def column(**options, &block) + column_name ||= options[:name] + column_name ||= options[:attribute] + options[:scope] = name.to_s.underscore.to_s.tr("/", ".").to_sym + columns[column_name] = Importo::ImportColumn.new(name: column_name, **options, &block) end def model(model = nil) @model = model if model @model