struct Bindgen::Crystal::Format
- Bindgen::Crystal::Format
- Struct
- Value
- Object
Overview
Formatter for Crystal style code.
Defined in:
bindgen/crystal/format.crConstructors
Instance Method Summary
-
#argument(arg : Call::Argument, idx, expose_default = true, binding = false) : String
Formats arg as
type name
. -
#argument_list(arguments : Enumerable(Call::Argument), binding = false) : String
Formats arguments as
type name, ...
. -
#floating_type?(type_name) : Bool
Returns
true
if type_name is a Crystal floating-type. -
#literal(type_name, value) : String | Nil
Generates a literal value suitable for Crystal code, using the value of type_name.
-
#number_literal(type_name, value) : String | Nil
Returns the number literal of type_name with value.
-
#number_literal_suffix(type_name) : String | Nil
Returns the literal-suffix for Crystal code, to signify a literal matching the intended type_name.
-
#qualified_enum_name(type : Parser::Type, value : Int) : String | Nil
Returns the qualified name of value in the enum called enum_name.
Constructor Detail
Instance Method Detail
Formats arg as type name
. If binding is true
, treat this as
argument for a fun
declaration.
Formats arguments as type name, ...
. If binding is true
, treat
this as argument for a fun
declaration.
Generates a literal value suitable for Crystal code, using the value of type_name. type_name is a completely deduced Crystal type-name.
Returns nil
if type_name is unknown (It's not built-in). Try
#qualified_enum_name
in that case if it might be an enum.
Returns the number literal of type_name with value. The result is valid a Crystal literal, and can be directly written.
Returns the literal-suffix for Crystal code, to signify a literal matching the intended type_name.
If type_name is unknown, returns nil
.
Returns the qualified name of value in the enum called enum_name.
Builds a .flags(...)
list if the enum turns out to be a @[Flags]
.