Sha256: 4cfab0b1e253a220ec714dea254cd8bcaddc46612ea83e111f1cddaed0464f55
Contents?: true
Size: 1.41 KB
Versions: 2
Compression:
Stored size: 1.41 KB
Contents
const NodejsStringBuilder = require('../internal/NodejsStringBuilder') const Handlers = require('./Handlers') const fs = require('fs') class GeneratorHandler { generate(command, file_path) { let generator_handlers = new Handlers() let loadedClassFiles = [] for (let i = 0; i < command.payload.length; i++) { let existing_string_builder = new NodejsStringBuilder() let payloadItem = command.payload[i] generator_handlers.GENERATOR_HANDLER[command.payload[i].commandType].generate_code( existing_string_builder, command, command.payload[i], generator_handlers ) this.generate_class_file(existing_string_builder, command.payload[i].payload[0], file_path) loadedClassFiles.push( this.generate_class_file(existing_string_builder, payloadItem.payload[0], file_path) ) } return loadedClassFiles } generate_class_file(existing_string_builder, class_file_name, file_path) { fs.writeFile( file_path + '\\' + class_file_name.substring(class_file_name.lastIndexOf('.') + 1) + '.js', existing_string_builder.getString(), function (err) { if (err) throw err } ) return existing_string_builder.getString() } } module.exports = GeneratorHandler
Version data entries
2 entries across 2 versions & 1 rubygems