Class: Gitlab::Suggestions::FileSuggestion
- Inherits:
-
Object
- Object
- Gitlab::Suggestions::FileSuggestion
- Includes:
- Utils::StrongMemoize
- Defined in:
- lib/gitlab/suggestions/file_suggestion.rb
Constant Summary collapse
- SuggestionForDifferentFileError =
Class.new(StandardError)
Instance Attribute Summary collapse
-
#blob ⇒ Object
readonly
Returns the value of attribute blob.
-
#file_path ⇒ Object
readonly
Returns the value of attribute file_path.
-
#suggestions ⇒ Object
readonly
Returns the value of attribute suggestions.
Instance Method Summary collapse
-
#initialize(file_path, suggestions) ⇒ FileSuggestion
constructor
A new instance of FileSuggestion.
- #line_conflict? ⇒ Boolean
- #new_content ⇒ Object
Constructor Details
#initialize(file_path, suggestions) ⇒ FileSuggestion
Returns a new instance of FileSuggestion.
14 15 16 17 18 |
# File 'lib/gitlab/suggestions/file_suggestion.rb', line 14 def initialize(file_path, suggestions) @file_path = file_path @suggestions = suggestions.sort_by(&:from_line_index) @blob = suggestions.first&.diff_file&.new_blob end |
Instance Attribute Details
#blob ⇒ Object (readonly)
Returns the value of attribute blob.
11 12 13 |
# File 'lib/gitlab/suggestions/file_suggestion.rb', line 11 def blob @blob end |
#file_path ⇒ Object (readonly)
Returns the value of attribute file_path.
10 11 12 |
# File 'lib/gitlab/suggestions/file_suggestion.rb', line 10 def file_path @file_path end |
#suggestions ⇒ Object (readonly)
Returns the value of attribute suggestions.
12 13 14 |
# File 'lib/gitlab/suggestions/file_suggestion.rb', line 12 def suggestions @suggestions end |
Instance Method Details
#line_conflict? ⇒ Boolean
20 21 22 23 24 |
# File 'lib/gitlab/suggestions/file_suggestion.rb', line 20 def line_conflict? strong_memoize(:line_conflict) do _line_conflict? end end |
#new_content ⇒ Object
26 27 28 |
# File 'lib/gitlab/suggestions/file_suggestion.rb', line 26 def new_content @new_content ||= _new_content end |