module CrystalByteProtocol::CrystalToJS

Overview

Convert Crystal protocol messages to JavaScript, using the https://github.com/j8r/js-byte-format library.

Defined in:

crystal_to_js_byte_format.cr

Constant Summary

Types = {String, Bool, Int8, UInt8, Int16, UInt16, Int32, UInt32, Float32, Float64}

Class Method Summary

Class Method Detail

def self.convert(io : IO, type : T.class, source_type : SourceType) : Nil forall T #

Converts a type to JS.


[View source]
def self.convert_all(io : IO, type : T.class, source_type : SourceType) forall T #

Yiels each object name of T with its JS conversion. If the object contains others, they are also added.


[View source]
def self.convert_enum(io : IO, type : Enum.class, source_type : SourceType, types : Bool = false) : Nil #

Converts an enum to JS. If no name is defined, it is supposed to be a string enum of a message.


[View source]
def self.convert_to_dict(io : IO, type : T.class, source_type : SourceType, types : Bool = false) : Nil forall T #

[View source]
def self.convert_to_file(file : Path | String, module_to_convert : M.class, file_path = __FILE__) forall M #

[View source]
def self.type_last_name(type) #

[View source]