Module: Suggestible
- Extended by:
- ActiveSupport::Concern
- Includes:
- Gitlab::Utils::StrongMemoize
- Included in:
- Gitlab::Diff::Suggestion, Suggestion
- Defined in:
- app/services/concerns/suggestible.rb
Constant Summary collapse
- MAX_LINES_CONTEXT =
This translates into limiting suggestion changes to ‘suggestion:-100+100`.
100
Instance Method Summary collapse
- #diff_file ⇒ Object
- #diff_lines ⇒ Object
- #fetch_from_content ⇒ Object
- #from_line ⇒ Object
- #target_line ⇒ Object
- #to_line ⇒ Object
Instance Method Details
#diff_file ⇒ Object
30 31 32 |
# File 'app/services/concerns/suggestible.rb', line 30 def diff_file raise NotImplementedError end |
#diff_lines ⇒ Object
10 11 12 13 14 |
# File 'app/services/concerns/suggestible.rb', line 10 def diff_lines strong_memoize(:diff_lines) do Gitlab::Diff::SuggestionDiff.new(self).diff_lines end end |
#fetch_from_content ⇒ Object
16 17 18 |
# File 'app/services/concerns/suggestible.rb', line 16 def fetch_from_content diff_file.new_blob_lines_between(from_line, to_line).join end |
#from_line ⇒ Object
20 21 22 23 |
# File 'app/services/concerns/suggestible.rb', line 20 def from_line real_above = [lines_above, MAX_LINES_CONTEXT].min [target_line - real_above, 1].max end |
#target_line ⇒ Object
34 35 36 |
# File 'app/services/concerns/suggestible.rb', line 34 def target_line raise NotImplementedError end |
#to_line ⇒ Object
25 26 27 28 |
# File 'app/services/concerns/suggestible.rb', line 25 def to_line real_below = [lines_below, MAX_LINES_CONTEXT].min target_line + real_below end |