class

Sheety::CroupierGenerator

Inherits Sheety::AST < Reference < Object

Generates and registers Croupier tasks from Excel formulas

Constants

CHUNK_SIZE = 500
SPLIT_THRESHOLD = 500

Above this many formula cells, split the task table across chunk files so the compiler stays within modest memory. Measured: chunk size 500 caps peak RSS at ~1.5GB for a 9900-cell sheet (vs ~13.8GB single-file).

Constructors

Class methods

write_generated(gen : GeneratedSource, entrypoint_path : String) : Nil

Write a GeneratedSource to disk: the entrypoint to entrypoint_path, and each aux file into the same directory. The four crystal-build call sites then compile just the entrypoint (which requires its sibling chunks).

Source

Instance methods

add_formula(cell : String, formula : String, sheet : String | Nil = nil) : self

Add a formula to be converted to a task

Source
generate_source(initial_values : Hash(String, BigFloat | String | Bool) = Hash(String, BigFloat | String | Bool).new, interactive : Bool = false, source_file : String | Nil = nil, intermediate_file : String | Nil = nil, chunk_prefix : String = "sheety") : GeneratedSource

Generate Crystal source code for all tasks. Returns a GeneratedSource: the entrypoint program plus, for large sheets, auxiliary chunk files the entrypoint requires. Callers write the entrypoint to their chosen path and the aux files into the same directory. chunk_prefix names the chunk files (e.g. "abc123" -> "abc123_tasks_0.cr") so sheets sharing a tmp dir don't collide; required only when splitting.

Source
set_kv_store_path(path : String) : self

Set the path for the persistent k/v store

Source
set_original_filename(filename : String) : self

Set the original filename (for save functionality)

Source
set_spreadsheet_uuid(uuid : String) : self

Set the spreadsheet UUID (for tracking purposes)

Source
set_state_file_path(path : String) : self

Set the path for the .croupier state file

Source

Nested types