Class: Moku6::Generators::RubyGenerator
- Inherits:
-
BaseGenerator
- Object
- BaseGenerator
- Moku6::Generators::RubyGenerator
- Defined in:
- lib/moku6/generators/ruby_generator.rb
Overview
Emits Ruby constants for every action (design section 12.4).
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
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/moku6/generators/ruby_generator.rb', line 9 def render consts = @catalog.sorted.map { |e| [const_name(e), e.action] } out = ["# frozen_string_literal: true", "# #{AUTOGEN_NOTE}", "module AuditEvents"] consts.each { |name, action| out << " #{name} = #{action.inspect}" } out << "" out << " ALL = [#{consts.map(&:first).join(", ")}].freeze" out << "end" out << "" out.join("\n") end |