historian v0.11.0-beta.2 Historian.History View Source

A data structure for managing histories.

Link to this section Summary

Functions

Returns a line from the history buffer by it's index.

Pluck takes a list of line ids returning an updated history buffer containing only lines coresponding to the ids.

Pluck takes a list of line numbers returning a list containing only lines coresponding to the matching ids (or an empty list if there are no matches).

Search the history buffer's values matching the pattern, and return an updated History buffer containing only the matching items.

Search the history buffer's values matching the pattern, and return only the matching items.

Slice the history buffer's using the given bounds, and return a list containing only the sliced items.

Slice the history buffer's using the given bounds, and return an updated buffer containing only the sliced items.

Link to this section Types

Link to this type

t(item)

View Source
t(item) :: %Historian.History{__meta__: map(), items: [item], name: atom()}

Link to this section Functions

Link to this function

create(lines, name \\ :default)

View Source
Link to this function

line_at(map, index)

View Source
line_at(history :: t(Historian.History.Item.t()), index :: non_neg_integer()) ::
  Historian.History.Item.t() | nil

Returns a line from the history buffer by it's index.

Pluck takes a list of line ids returning an updated history buffer containing only lines coresponding to the ids.

Link to this function

pluck!(history, line_numbers)

View Source
pluck!(
  history :: t(Historian.History.Item.t()),
  line_numbers :: [non_neg_integer()]
) :: [Historian.History.Item.t()]
pluck!(
  history :: t(Historian.History.Item.t()),
  line_number :: non_neg_integer()
) :: t(Historian.History.Item.t())

Pluck takes a list of line numbers returning a list containing only lines coresponding to the matching ids (or an empty list if there are no matches).

Link to this function

search(history, pattern)

View Source
search(history :: t(Historian.History.Item.t()), pattern :: Regex.t()) ::
  t(Historian.History.Item.t())

Search the history buffer's values matching the pattern, and return an updated History buffer containing only the matching items.

Link to this function

search!(history, pattern)

View Source
search!(history :: t(Historian.History.Item.t()), pattern :: Regex.t()) :: [
  Historian.History.Item.t()
]

Search the history buffer's values matching the pattern, and return only the matching items.

Link to this function

slice(history, start, stop)

View Source
slice(
  history :: t(Historian.History.Item.t()),
  start :: non_neg_integer(),
  stop :: integer()
) :: t(Historian.History.Item.t())

Slice the history buffer's using the given bounds, and return a list containing only the sliced items.

Link to this function

slice!(history, start, stop)

View Source
slice!(
  history :: t(Historian.History.Item.t()),
  start :: non_neg_integer(),
  stop :: integer()
) :: [Historian.History.Item.t()]

Slice the history buffer's using the given bounds, and return an updated buffer containing only the sliced items.