The Macaw logo, a scarlet macaw in flight

macaw_format

This software is a very early release, and not ready for general use.

Public home: github.com/dcoai/macaw_format · Docs: hexdocs.pm

Presentation for the Macaw family: how a value, a time and a measure read to a person (spec/00). It depends on macaw_units and macaw_base only, so macaw_draw writes values without depending on macaw_data, and macaw_data depends on units, not on format (dco-tek/macaw/macaw#478).

Module What it is
Macaw.Format a number's format, a d3-format specifier read once into data: parse/2, number/2 (spec/01 §1, §2, §4); a time's, a strftime pattern: parse_time/2, time/2 (§5); a field's default, from its measure: for_measure/2, measure/2 (§6); format_error/1
Macaw.Format.Locale a d3-format locale definition as data: english/0, new/1 (spec/01 §3)
Macaw.Format.Time a strftime pattern compiled once into its parts (spec/01 §5)
Macaw.Format.Measure a field's default format, its unit's conversions resolved once (spec/01 §6)
Macaw.Format.Alias the symbols a person types, read as UCUM codes or refused naming their choices: parse/1, format_error/1 (spec/02 §1)
Macaw.Format.Quantity a quantity's presentation: family/2,3 (spec/02 §2), systems/0 (§3), label/1 (§5)
Macaw.Format.Error what every ! twin raises: its value twin's reason, worded by macaw_base's Macaw.Base.Fault.sentence/2 with format's words (spec/00 §3)

Meaning is not here: a unit's code, dimension, conversion and symbol, and a quantity's list, base unit, kind, bounds and additivity, are macaw_units'.

Installation

Two runtime dependencies, macaw_units and macaw_base. From Hex:

{:macaw_format, "~> 0.1.0"}

Part of Macaw.

License

MIT; see the LICENSE file.