Class: Moku6::Generators::RailsGenerator
- Inherits:
-
BaseGenerator
- Object
- BaseGenerator
- Moku6::Generators::RailsGenerator
- Defined in:
- lib/moku6/generators/rails_generator.rb
Overview
Emits a Ruby SDK with one typed emitter method per action. Each method builds the canonical envelope and hands it to a configurable sink, so a Rails app can wire it to an outbox (design section 13: Rails SDK).
Constant Summary
Constants inherited from BaseGenerator
Instance Method Summary collapse
-
#render ⇒ Object
: () -> String.
Methods inherited from BaseGenerator
Constructor Details
This class inherits a constructor from Moku6::Generators::BaseGenerator
Instance Method Details
#render ⇒ Object
: () -> String
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/moku6/generators/rails_generator.rb', line 11 def render out = ["# frozen_string_literal: true", "# #{AUTOGEN_NOTE}", ""] out << 'require "securerandom"' out << 'require "time"' out << "" out << "module AuditEvents" out.concat(sink_block) out << "" out << " module Emitter" out << " module_function" @catalog.sorted.each do |e| out << "" out.concat(emitter_method(e)) end out << " end" out << "end" out << "" out.join("\n") end |