module

Sheety::CroupierHelpers

Helper functions for generated spreadsheet binaries

These are included in the generated Crystal code to provide efficient cell value fetching operations.

Instance methods

bin_add(left, right) : String | Nil

Helper for binary arithmetic operations

Source
bin_div(left, right) : String | Nil
Source
bin_mul(left, right) : String | Nil
Source
bin_pow(left, right) : String | Nil
Source
bin_sub(left, right) : String | Nil
Source
fetch_cell(cell_ref : String) : String

Fetch a single cell value with default fallback

Source
fetch_cell_range(sheet : String, start_col : String, start_row : Int32, end_col : String, end_row : Int32) : Array(String)

Fetch a range of cells (e.g., "Sheet1!A1:A100")

Source
format_result(result) : String

Convert task result to string for k/v store output

Source
initialize_cells(cells : Hash(String, String))

Initialize multiple cells at once from a hash

Source
initialize_range(sheet : String, start_col : String, start_row : Int32, end_col : String, end_row : Int32) : Nil

Initialize all cells in a range to empty strings This is needed because Croupier requires all input keys to exist

Source
range_inputs(sheet : String, start_col : String, start_row : Int32, end_col : String, end_row : Int32) : Array(String)

Generate k/v store input keys for a range

Source
register_formula_task(id : String, inputs : Array(String), output : String, &block : -> String) : Nil

Register one formula task. This is a thin wrapper around Croupier::Task.new so that the generated source can register thousands of tasks from a single data-driven loop (one Task.new call site in the compiled program) instead of emitting a literal Task.new block per cell — which made the Crystal compiler run out of memory on large sheets.

Source