Module: OpenReceive::FulfillmentNote
- Defined in:
- lib/openreceive/fulfillment_note.rb
Overview
The ONE canonical statement of the host's exactly-once fulfillment duty — what the engine guarantees about on_paid and where that guarantee stops — rendered wherever the install generator writes host-facing code.
The text lives in spec/data/fulfillment-note.txt and is generated into both this gem and @openreceive/core, so the Rails install generator and the scaffold CLI cannot give different advice.
Constant Summary collapse
- DEFAULT_TABLE =
"openreceive_payments"
Class Method Summary collapse
- .lines(table: DEFAULT_TABLE) ⇒ Object
-
.render(prefix: "", table: DEFAULT_TABLE) ⇒ Object
The note with every line given
prefix(already including any trailing space).
Class Method Details
.lines(table: DEFAULT_TABLE) ⇒ Object
26 27 28 |
# File 'lib/openreceive/fulfillment_note.rb', line 26 def lines(table: DEFAULT_TABLE) Generated::FULFILLMENT_NOTE_TEMPLATE.map { |line| line.gsub("{{table}}", table) } end |
.render(prefix: "", table: DEFAULT_TABLE) ⇒ Object
The note with every line given prefix (already including any trailing
space). Pass "# " for Ruby comments, "-- " for SQL, or "" for prose.
Blank lines drop the prefix's trailing space, so no comment block ends up
with trailing whitespace an editor or linter would strip.
22 23 24 |
# File 'lib/openreceive/fulfillment_note.rb', line 22 def render(prefix: "", table: DEFAULT_TABLE) lines(table: table).map { |line| line.empty? ? prefix.rstrip : "#{prefix}#{line}" }.join("\n") end |