Class: Moku6::Generators::TypeScriptGenerator

Inherits:
BaseGenerator show all
Defined in:
lib/moku6/generators/typescript_generator.rb

Constant Summary

Constants inherited from BaseGenerator

BaseGenerator::AUTOGEN_NOTE

Instance Method Summary collapse

Methods inherited from BaseGenerator

#initialize, #write

Constructor Details

This class inherits a constructor from Moku6::Generators::BaseGenerator

Instance Method Details

#renderObject

: () -> String



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/moku6/generators/typescript_generator.rb', line 8

def render
  events = @catalog.sorted
  out = ["// #{AUTOGEN_NOTE}", ""]
  out.concat(union_type(events))
  out << ""
  events.each { |e| out.concat(interface(e)) }
  out << "export interface AuditEventMetadataMap {"
  events.each { |e| out << "  \"#{e.action}\": #{iface_name(e)};" }
  out << "}"
  out << ""
  out.join("\n")
end