View Source ExPomodoro.Pomodoro (ExPomodoro v1.0.0)

This module is repsonsible for defining the domain model for the Pomodoro technique.

Link to this section Summary

Functions

Given a Elixir.ExPomodoro.Pomodoro struct, returns a new struct in a break activity.

Given a Elixir.ExPomodoro.Pomodoro struct, completes the current round by assigning a new activity.

The default duration of breaks.

The default duration of the exercise.

The default rounds number.

Given a Elixir.ExPomodoro.Pomodoro struct, returns a new struct with an increased round in an exercise activity.

Given a Elixir.ExPomodoro.Pomodoro struct, returns a new struct in an :idle activity.

Given an id and a keyword of options, returns a new Elixir.ExPomodoro.Pomodoro struct. The options can redefine the following fields, otherwise the default values will be used

Given a Elixir.ExPomodoro.Pomodoro struct, starts a new round by increasing the current round and assigning a new activity.

Given a Elixir.ExPomodoro.Pomodoro struct and options, returns a new one with it's fields updated.

Link to this section Types

@type activity() :: :exercise | :break | :idle | :finished
@type id() :: String.t()
@type opts() :: [
  exercise_duration: non_neg_integer(),
  break_duration: non_neg_integer(),
  rounds: non_neg_integer()
]
@type t() :: %ExPomodoro.Pomodoro{
  activity: term(),
  break_duration: term(),
  current_duration: term(),
  current_round: term(),
  exercise_duration: term(),
  id: term(),
  rounds: term()
}

Link to this section Functions

@spec break(t()) :: t()

Given a Elixir.ExPomodoro.Pomodoro struct, returns a new struct in a break activity.

Link to this function

complete_round(pomodoro)

View Source
@spec complete_round(t()) :: t()

Given a Elixir.ExPomodoro.Pomodoro struct, completes the current round by assigning a new activity.

Link to this function

default_break_duration()

View Source
@spec default_break_duration() :: non_neg_integer()

The default duration of breaks.

Link to this function

default_exercise_duration()

View Source
@spec default_exercise_duration() :: non_neg_integer()

The default duration of the exercise.

@spec default_rounds() :: non_neg_integer()

The default rounds number.

@spec exercise(t()) :: t()

Given a Elixir.ExPomodoro.Pomodoro struct, returns a new struct with an increased round in an exercise activity.

@spec idle(t()) :: t()

Given a Elixir.ExPomodoro.Pomodoro struct, returns a new struct in an :idle activity.

@spec new(id(), opts()) :: t() | {:error, :invalid_rounds | :rounds_cant_be_zero}

Given an id and a keyword of options, returns a new Elixir.ExPomodoro.Pomodoro struct. The options can redefine the following fields, otherwise the default values will be used:

  • exercise_duration: the amount of time intended to spend on task completion, in milliseconds (default: 25 minutes).
  • break_duration: the amount of time the break lasts, in milliseconds (default: 5 minutes).
  • rounds: the number of rounds until the pomodoro finishes (default: 4).
@spec start_round(t()) :: t()

Given a Elixir.ExPomodoro.Pomodoro struct, starts a new round by increasing the current round and assigning a new activity.

@spec update(t(), opts()) :: t() | {:error, :invalid_rounds | :rounds_cant_be_zero}

Given a Elixir.ExPomodoro.Pomodoro struct and options, returns a new one with it's fields updated.