def set_attribute(model, column, csv_value)
      column_definition = column.definition
      if column_definition.to && column_definition.to.is_a?(Proc)
        to_proc = column_definition.to

        case to_proc.arity
        when 1 # to: ->(email) { email.downcase }
          model.public_send("#{column_definition.name}=", to_proc.call(csv_value))
        when 2 # to: ->(published, post) { post.published_at = Time.now if published == "true" }
          to_proc.call(csv_value, model)
        when 3 # to: ->(field_value, post, column) { post.hash_field[column.name] = field_value }
          to_proc.call(csv_value, model, column)
        else
          raise ArgumentError, "`to` proc can only have 1, 2 or 3 arguments"
        end
      else
        attribute = column_definition.attribute
        model.public_send("#{attribute}=", csv_value)
      end

      model
    end
def set_attribute(model, column, csv_value)
      column_definition = column.definition
      if column_definition.to && column_definition.to.is_a?(Proc)
        to_proc = column_definition.to

        case to_proc.arity
        when 1 # to: ->(email) { email.downcase }
          model.public_send("#{column_definition.name}=", to_proc.call(csv_value))
        when 2 # to: ->(published, post) { post.published_at = Time.now if published == "true" }
          to_proc.call(csv_value, model)
        when 3 # to: ->(field_value, post, column) { post.hash_field[column.name] = field_value }
          to_proc.call(csv_value, model, column)
        else
          raise ArgumentError, "`to` proc can only have 1, 2 or 3 arguments"
        end
      else
        attribute = column_definition.attribute
        model.public_send("#{attribute}=", csv_value)
      end

      model
    end
Set the attribute using the column_definition and the csv_value