Class: RosettAi::Provenance::FileSource
- Inherits:
-
Object
- Object
- RosettAi::Provenance::FileSource
- Defined in:
- lib/rosett_ai/provenance/file_source.rb
Overview
Represents a file-level source reference within a provenance entry.
Tracks which files were involved in an AI contribution and what lines or sections were affected.
Instance Attribute Summary collapse
-
#lines ⇒ Object
readonly
Returns the value of attribute lines.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#source_type ⇒ Object
readonly
Returns the value of attribute source_type.
Instance Method Summary collapse
-
#initialize(path:, source_type:, lines: nil) ⇒ FileSource
constructor
A new instance of FileSource.
-
#to_h ⇒ Hash
Serializable representation.
Constructor Details
#initialize(path:, source_type:, lines: nil) ⇒ FileSource
Returns a new instance of FileSource.
18 19 20 21 22 |
# File 'lib/rosett_ai/provenance/file_source.rb', line 18 def initialize(path:, source_type:, lines: nil) @path = path.freeze @lines = lines&.freeze @source_type = source_type.freeze end |
Instance Attribute Details
#lines ⇒ Object (readonly)
Returns the value of attribute lines.
13 14 15 |
# File 'lib/rosett_ai/provenance/file_source.rb', line 13 def lines @lines end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
13 14 15 |
# File 'lib/rosett_ai/provenance/file_source.rb', line 13 def path @path end |
#source_type ⇒ Object (readonly)
Returns the value of attribute source_type.
13 14 15 |
# File 'lib/rosett_ai/provenance/file_source.rb', line 13 def source_type @source_type end |
Instance Method Details
#to_h ⇒ Hash
Returns serializable representation.
25 26 27 28 29 |
# File 'lib/rosett_ai/provenance/file_source.rb', line 25 def to_h hash = { 'path' => @path, 'source_type' => @source_type } hash['lines'] = @lines if @lines hash end |