Sha256: 7d62cd5eec8f97d9e9560732ede3041eb4815c8eba875bcbd2d528c35add58ad

Contents?: true

Size: 1.26 KB

Versions: 62

Compression:

Stored size: 1.26 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

62 entries across 36 versions & 1 rubygems

Version Path
javonet-ruby-sdk-2.5.8 lib/javonet-ruby-sdk/Binaries/Nodejs/core/generator/handler/GeneratorHandler.js
javonet-ruby-sdk-2.5.7 lib/javonet-ruby-sdk/Binaries/Nodejs/core/generator/handler/GeneratorHandler.js
javonet-ruby-sdk-2.5.6 lib/javonet-ruby-sdk/Binaries/Nodejs/core/generator/handler/GeneratorHandler.js
javonet-ruby-sdk-2.5.5 lib/javonet-ruby-sdk/Binaries/Nodejs/core/generator/handler/GeneratorHandler.js
javonet-ruby-sdk-2.5.4 lib/javonet-ruby-sdk/Binaries/Nodejs/core/generator/handler/GeneratorHandler.js
javonet-ruby-sdk-2.5.3 lib/javonet-ruby-sdk/Binaries/Nodejs/core/generator/handler/GeneratorHandler.js
javonet-ruby-sdk-2.5.2 lib/javonet-ruby-sdk/Binaries/Nodejs/core/generator/handler/GeneratorHandler.js
javonet-ruby-sdk-2.5.1 lib/javonet-ruby-sdk/Binaries/Nodejs/core/generator/handler/GeneratorHandler.js
javonet-ruby-sdk-2.5.0 lib/javonet-ruby-sdk/Binaries/Nodejs/core/generator/handler/GeneratorHandler.js
javonet-ruby-sdk-2.4.11 lib/javonet-ruby-sdk/Binaries/Nodejs/core/generator/handler/GeneratorHandler.js
javonet-ruby-sdk-2.4.10 lib/javonet-ruby-sdk/Binaries/Nodejs/MacOs/X64/core/generator/handler/GeneratorHandler.js
javonet-ruby-sdk-2.4.10 lib/javonet-ruby-sdk/Binaries/Nodejs/Linux/X64/core/generator/handler/GeneratorHandler.js
javonet-ruby-sdk-2.4.9 lib/javonet-ruby-sdk/Binaries/Nodejs/Linux/X64/core/generator/handler/GeneratorHandler.js
javonet-ruby-sdk-2.4.9 lib/javonet-ruby-sdk/Binaries/Nodejs/MacOs/X64/core/generator/handler/GeneratorHandler.js
javonet-ruby-sdk-2.4.8 lib/javonet-ruby-sdk/Binaries/Nodejs/MacOs/X64/core/generator/handler/GeneratorHandler.js
javonet-ruby-sdk-2.4.8 lib/javonet-ruby-sdk/Binaries/Nodejs/Linux/X64/core/generator/handler/GeneratorHandler.js
javonet-ruby-sdk-2.4.7 lib/javonet-ruby-sdk/Binaries/Nodejs/Linux/X64/core/generator/handler/GeneratorHandler.js
javonet-ruby-sdk-2.4.7 lib/javonet-ruby-sdk/Binaries/Nodejs/MacOs/X64/core/generator/handler/GeneratorHandler.js
javonet-ruby-sdk-2.4.6 lib/javonet-ruby-sdk/Binaries/Nodejs/Linux/X64/core/generator/handler/GeneratorHandler.js
javonet-ruby-sdk-2.4.6 lib/javonet-ruby-sdk/Binaries/Nodejs/MacOs/X64/core/generator/handler/GeneratorHandler.js