View Source Cocktail.Builder.String (Cocktail v0.10.3)

Build human readable strings from schedules.

This module exposes functions for building human readable string representations of schedules. It currently only represents the recurrence rules of a schedule, and doesn't indicate the start time, duration, nor any recurrence times or exception times. This is mainly useful for quick glances at schedules in IEx sessions (because it's used for the inspect implementation) and for simple doctests.

Link to this section Summary

Functions

Builds a human readable string representation of a Cocktail.Schedule.t/0.

Link to this section Functions

@spec build(Cocktail.Schedule.t()) :: String.t()

Builds a human readable string representation of a Cocktail.Schedule.t/0.

examples

Examples

iex> alias Cocktail.Schedule
...> schedule = Schedule.new(~N[2017-01-01 06:00:00])
...> schedule = Schedule.add_recurrence_rule(schedule, :daily, interval: 2, hours: [10, 12])
...> build(schedule)
"Every 2 days on the 10th and 12th hours of the day"