Class: ActiveCortex::Generator::Boolean
Instance Attribute Summary
#field_name, #max_results, #model, #record
Class Method Summary
collapse
Instance Method Summary
collapse
#initialize, #save_generation
Class Method Details
.accepts?(record:, field_name:) ⇒ Boolean
2
3
4
|
# File 'lib/active_cortex/generator/boolean.rb', line 2
def self.accepts?(record:, field_name:)
record.class.attribute_types[field_name.to_s].type == :boolean
end
|
.generate(record:, field_name:) ⇒ Object
6
7
8
|
# File 'lib/active_cortex/generator/boolean.rb', line 6
def self.generate(record:, field_name:)
record.send("#{field_name}=", generation)
end
|
Instance Method Details
#generation ⇒ Object
10
11
12
|
# File 'lib/active_cortex/generator/boolean.rb', line 10
def generation
openai_content || raise(ActiveCortex::Error, openai_error_message)
end
|