Class: Super::Form::Guesser

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

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Guesser.



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

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

Instance Method Details

#callObject



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

def call
  Schema::Guesser
    .new(model: @model, fields: @fields, type: @type)
    .assign_type { |attribute_name| attribute_type_for(attribute_name) }
    .reject { |attribute_name| attribute_name == "id" }
    .reject { |attribute_name| attribute_name == "created_at" }
    .reject { |attribute_name| attribute_name == "updated_at" }
    .call
end