Class: Super::Display::Guesser

Inherits:
Object
  • Object
show all
Defined in:
lib/super/display/guesser.rb

Instance Method Summary collapse

Constructor Details

#initialize(model:, action:, fields:, type:) ⇒ Guesser

Returns a new instance of Guesser.



6
7
8
9
10
11
# File 'lib/super/display/guesser.rb', line 6

def initialize(model:, action:, fields:, type:)
  @model = model
  @action_inquirer = action
  @fields = fields
  @type = type
end

Instance Method Details

#callObject



13
14
15
16
17
18
19
20
# File 'lib/super/display/guesser.rb', line 13

def call
  Schema::Guesser
    .new(model: @model, fields: @fields, type: @type)
    .ignore_foreign_keys
    .limit { 5 if @action_inquirer.index? }
    .assign_type { |attribute_name| attribute_type_for(attribute_name) }
    .call
end