Concat

String concatenation

Signature

concat(expr: AttrName|(Tuple->Numeric)) -> Aggregator

Examples

concat(:name)
concat(:name, between: ', ')
concat(between: ', '){|t| t.name }
concat(->(t){ t.name.upcase }, between: ', ')

Description

Concatenates string representations of input values.

Implementation notes

This aggregate function can be applied to any data type, not only String attributes. Ruby's to_s will be used on values prior to concatenation.

The options are:

  • before starts the resulting string (defaults to '')
  • after ends the resulting string (defaults to '')
  • between is used between each value

As of current Alf version, the order in which the values are concatenated is not guaranteed. So far, this function is thus non-deterministic.