Class: RailsDoctor::Finding
- Inherits:
-
Struct
- Object
- Struct
- RailsDoctor::Finding
- Defined in:
- lib/rails_doctor/models.rb
Instance Attribute Summary collapse
-
#agent_instruction ⇒ Object
Returns the value of attribute agent_instruction.
-
#category ⇒ Object
Returns the value of attribute category.
-
#confidence ⇒ Object
Returns the value of attribute confidence.
-
#file ⇒ Object
Returns the value of attribute file.
-
#id ⇒ Object
Returns the value of attribute id.
-
#line ⇒ Object
Returns the value of attribute line.
-
#message ⇒ Object
Returns the value of attribute message.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#recommendation ⇒ Object
Returns the value of attribute recommendation.
-
#severity ⇒ Object
Returns the value of attribute severity.
-
#suggested_commands ⇒ Object
Returns the value of attribute suggested_commands.
-
#tool ⇒ Object
Returns the value of attribute tool.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(**kwargs) ⇒ Finding
constructor
A new instance of Finding.
- #to_h ⇒ Object
Constructor Details
#initialize(**kwargs) ⇒ Finding
Returns a new instance of Finding.
31 32 33 34 35 36 37 38 |
# File 'lib/rails_doctor/models.rb', line 31 def initialize(**kwargs) super self.id ||= self.class.generate_id(kwargs) self.severity ||= "medium" self.confidence ||= "medium" self.suggested_commands ||= [] self. ||= {} end |
Instance Attribute Details
#agent_instruction ⇒ Object
Returns the value of attribute agent_instruction
16 17 18 |
# File 'lib/rails_doctor/models.rb', line 16 def agent_instruction @agent_instruction end |
#category ⇒ Object
Returns the value of attribute category
16 17 18 |
# File 'lib/rails_doctor/models.rb', line 16 def category @category end |
#confidence ⇒ Object
Returns the value of attribute confidence
16 17 18 |
# File 'lib/rails_doctor/models.rb', line 16 def confidence @confidence end |
#file ⇒ Object
Returns the value of attribute file
16 17 18 |
# File 'lib/rails_doctor/models.rb', line 16 def file @file end |
#id ⇒ Object
Returns the value of attribute id
16 17 18 |
# File 'lib/rails_doctor/models.rb', line 16 def id @id end |
#line ⇒ Object
Returns the value of attribute line
16 17 18 |
# File 'lib/rails_doctor/models.rb', line 16 def line @line end |
#message ⇒ Object
Returns the value of attribute message
16 17 18 |
# File 'lib/rails_doctor/models.rb', line 16 def @message end |
#metadata ⇒ Object
Returns the value of attribute metadata
16 17 18 |
# File 'lib/rails_doctor/models.rb', line 16 def @metadata end |
#recommendation ⇒ Object
Returns the value of attribute recommendation
16 17 18 |
# File 'lib/rails_doctor/models.rb', line 16 def recommendation @recommendation end |
#severity ⇒ Object
Returns the value of attribute severity
16 17 18 |
# File 'lib/rails_doctor/models.rb', line 16 def severity @severity end |
#suggested_commands ⇒ Object
Returns the value of attribute suggested_commands
16 17 18 |
# File 'lib/rails_doctor/models.rb', line 16 def suggested_commands @suggested_commands end |
#tool ⇒ Object
Returns the value of attribute tool
16 17 18 |
# File 'lib/rails_doctor/models.rb', line 16 def tool @tool end |
Class Method Details
.generate_id(attrs) ⇒ Object
57 58 59 60 |
# File 'lib/rails_doctor/models.rb', line 57 def self.generate_id(attrs) seed = [attrs[:tool], attrs[:category], attrs[:file], attrs[:line], attrs[:message]].join(":") "rd-#{seed.hash.abs.to_s(36)}" end |
Instance Method Details
#to_h ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/rails_doctor/models.rb', line 40 def to_h { id: id, severity: severity, category: category, tool: tool, file: file, line: line, confidence: confidence, message: , recommendation: recommendation, agent_instruction: agent_instruction, suggested_commands: suggested_commands, metadata: }.compact end |