Class: Moku6::Generators::OutboxGenerator
- Inherits:
-
BaseGenerator
- Object
- BaseGenerator
- Moku6::Generators::OutboxGenerator
- Defined in:
- lib/moku6/generators/outbox_generator.rb
Overview
Emits a sample Rails transactional outbox for audit events: a migration, an ActiveRecord model, and a dispatcher (design section 13: Outbox sample). The files are a starting point and are meant to be edited.
Constant Summary collapse
- FILES =
{ "db/migrate/0001_create_audit_event_outbox.rb" => :migration, "app/models/audit_event_outbox.rb" => :model, "app/services/audit_event_dispatcher.rb" => :dispatcher }.freeze
Constants inherited from BaseGenerator
Instance Method Summary collapse
-
#write(dir) ⇒ Object
: (String dir) -> String.
Methods inherited from BaseGenerator
Constructor Details
This class inherits a constructor from Moku6::Generators::BaseGenerator
Instance Method Details
#write(dir) ⇒ Object
: (String dir) -> String
19 20 21 22 23 24 25 26 |
# File 'lib/moku6/generators/outbox_generator.rb', line 19 def write(dir) FILES.each do |rel, kind| path = File.join(dir, rel) FileUtils.mkdir_p(File.dirname(path)) File.write(path, send(kind)) end dir end |