Class: AIRecordFinder::SchemaIntrospector

Inherits:
Object
  • Object
show all
Defined in:
lib/ai_record_finder/schema_introspector.rb

Overview

Extracts a safe summary of model schema that can be sent to the AI.

Instance Method Summary collapse

Constructor Details

#initialize(model) ⇒ SchemaIntrospector

Returns a new instance of SchemaIntrospector.



6
7
8
# File 'lib/ai_record_finder/schema_introspector.rb', line 6

def initialize(model)
  @model = model
end

Instance Method Details

#callObject



10
11
12
13
14
15
16
17
18
19
# File 'lib/ai_record_finder/schema_introspector.rb', line 10

def call
  {
    model: @model.name,
    table: @model.table_name,
    columns: columns_summary,
    associations: associations_summary,
    association_columns: association_columns_summary,
    enums: enums_summary
  }
end