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.crConstant Summary
-
Types =
{String, Bool, Int8, UInt8, Int16, UInt16, Int32, UInt32, Float32, Float64}
Class Method Summary
-
.convert(io : IO, type : T.class, source_type : SourceType) : Nil forall T
Converts a type to JS.
-
.convert_all(io : IO, type : T.class, source_type : SourceType) forall T
Yiels each object name of
T
with its JS conversion. -
.convert_enum(io : IO, type : Enum.class, source_type : SourceType, types : Bool = false) : Nil
Converts an enum to JS.
- .convert_to_dict(io : IO, type : T.class, source_type : SourceType, types : Bool = false) : Nil forall T
- .convert_to_file(file : Path | String, module_to_convert : M.class, file_path = __FILE__) forall M
- .type_last_name(type)
Class Method Detail
Converts a type to JS.
Yiels each object name of T
with its JS conversion. If the object contains others, they are also added.
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.
def self.convert_to_dict(io : IO, type : T.class, source_type : SourceType, types : Bool = false) : Nil forall T
#
def self.convert_to_file(file : Path | String, module_to_convert : M.class, file_path = __FILE__) forall M
#