Methods
blank() → {CodeBuilder}
Append a blank line.
- Source:
Returns:
This builder, for chaining.
- Type
- CodeBuilder
comment(text, levelopt) → {CodeBuilder}
Append a `#`-prefixed Python comment at the given indent level.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
text |
string | Comment text (without the leading `#`). | ||
level |
number |
<optional> |
0 | Number of indent levels. |
- Source:
Returns:
This builder, for chaining.
- Type
- CodeBuilder
indent(text, levelopt) → {CodeBuilder}
Append a line prefixed with the given number of 4-space indent levels.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
text |
string | Line contents. | ||
level |
number |
<optional> |
1 | Number of indent levels. |
- Source:
Returns:
This builder, for chaining.
- Type
- CodeBuilder
line(textopt) → {CodeBuilder}
Append a single line of text.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
text |
string |
<optional> |
'' | Line contents. |
- Source:
Returns:
This builder, for chaining.
- Type
- CodeBuilder
multiline(text) → {CodeBuilder}
Append a multi-line string as separate lines.
Parameters:
| Name | Type | Description |
|---|---|---|
text |
string | Newline-separated text. |
- Source:
Returns:
This builder, for chaining.
- Type
- CodeBuilder
toString() → {string}
Render all accumulated lines as a single newline-joined string.
- Source:
Returns:
The built source code.
- Type
- string