From 015a7fd527e7e28cd3c754fbfba331a8c8991f99 Mon Sep 17 00:00:00 2001 From: Keenan Brock Date: Fri, 9 Aug 2024 20:47:34 -0400 Subject: [PATCH] fix tools/feature_supports_matrix I don't know the true purpose of this code. But it was referencing QUERYABLE_FEATURES which went away 5dae6457fc (in 3/15/2021) I went in here because I was adding supports feature mixin to all models and grep showed me this class --- tools/feature_support_matrix.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/feature_support_matrix.rb b/tools/feature_support_matrix.rb index a3bc5d1b795..e25f969d34c 100755 --- a/tools/feature_support_matrix.rb +++ b/tools/feature_support_matrix.rb @@ -1,6 +1,7 @@ #!/usr/bin/env ruby require File.expand_path('../config/environment', __dir__) require 'csv' +require 'set' def usage <<-USAGE @@ -22,13 +23,16 @@ def accept(visitor) end end +$all_features = Set.new + def matrix_for(model) matrix = FeatureMatrix.new matrix.model = model if model.included_modules.include?(SupportsFeatureMixin) - matrix.features = SupportsFeatureMixin::QUERYABLE_FEATURES.keys.each_with_object({}) do |feature, features| + matrix.features = model.supports_features.keys.each_with_object({}) do |feature, features| features[feature] = model.supports?(feature) + $all_features << feature end end @@ -56,7 +60,7 @@ def visit(subject) def to_s headers = @rows.first.headers CSV.generate('', :headers => headers) do |csv| - header_row = CSV::Row.new(headers, %w[Model] + SupportsFeatureMixin::QUERYABLE_FEATURES.values) + header_row = CSV::Row.new(headers, %w[Model] + $all_features.to_a) csv << header_row @rows.each { |row| csv << row } end