Packages

File parser for popular excel formats: xls (Excel 2003), csv, xlsx (Excel 2007). Stores data in ets (except for csv, which uses stream).

Current section

Files

Jump to
suexcxine_exoffice lib exoffice parser excel_2003 state_manager.ex
Raw

lib/exoffice/parser/excel_2003/state_manager.ex

defmodule Exoffice.Parser.Excel2003.Index do
@moduledoc """
An Agent process named `Index` which holds state of an index. Provides functions to create the process, increment the index by 1, retrieve the current index
and ultimately kill the process.
"""
@doc """
Initiates a new `Index` Agent process with a value of `0`.
"""
def new do
Agent.start_link(fn -> 0 end, name: __MODULE__)
end
@doc """
Increments active `Index` Agent process by `1`.
"""
def inc do
Agent.update(__MODULE__, &(&1 + 1))
end
@doc """
Returns current value of `Index` Agent process
"""
def get do
Agent.get(__MODULE__, & &1)
end
@doc """
Deletes `Index` Agent process
"""
def del do
Agent.stop(__MODULE__)
end
end