Class: FastExists::Intelligence::Analyzer
- Inherits:
-
Object
- Object
- FastExists::Intelligence::Analyzer
- Defined in:
- lib/fast_exists/intelligence/analyzer.rb
Constant Summary collapse
- PREFERRED_CANDIDATES =
%w[ email username slug sku phone uuid api_key external_id oauth_id token session_id identifier code ].freeze
- EXCLUDED_TYPES =
[:json, :jsonb, :text, :binary, :boolean].freeze
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.analyze(target = nil, attribute = nil, models: nil) ⇒ Object
12 13 14 |
# File 'lib/fast_exists/intelligence/analyzer.rb', line 12 def self.analyze(target = nil, attribute = nil, models: nil) new.analyze(target, attribute, models: models) end |
Instance Method Details
#analyze(target = nil, attribute = nil, models: nil) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/fast_exists/intelligence/analyzer.rb', line 16 def analyze(target = nil, attribute = nil, models: nil) target_models = determine_models(target, models) model_results = {} target_models.each do |klass| next unless klass.respond_to?(:table_exists?) && klass.table_exists? model_analysis = analyze_model(klass, attribute) model_results[klass.name] = model_analysis if model_analysis[:candidates].any? || target end tenant_info = analyze_tenants { application: collect_app_info, models: model_results, tenant_analysis: tenant_info, overall_suitability_score: calculate_overall_score(model_results) } end |