Class: HunkReviewChanges::Export
- Inherits:
-
Object
- Object
- HunkReviewChanges::Export
- Defined in:
- lib/hunk_review_changes/export.rb
Overview
Builds export.md: the pieces that need action, as a paste-ready markdown block the launching agent reads to implement each requested change.
Instance Method Summary collapse
-
#initialize(bundle, state) ⇒ Export
constructor
A new instance of Export.
- #to_markdown ⇒ Object
Constructor Details
#initialize(bundle, state) ⇒ Export
Returns a new instance of Export.
7 8 9 10 |
# File 'lib/hunk_review_changes/export.rb', line 7 def initialize(bundle, state) @bundle = bundle @state = state end |
Instance Method Details
#to_markdown ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/hunk_review_changes/export.rb', line 12 def to_markdown lines = header actionable = @bundle.pieces.select { |piece| State.actionable?(@state[piece["id"]]) } if actionable.empty? lines << no_changes_note return "#{lines.join("\n").strip}\n" end lines << "The pieces below have comments to act on. Implement each `change`; " \ "list each `flag` for the user to decide before touching it." lines << "" actionable.each { |piece| lines.concat(piece_lines(piece)) } "#{lines.join("\n").strip}\n" end |