leptus_utils
Functions
priv_dir/1
Finds the path to the priv directory in an application.
priv_dir(App) -> Dir | {error, bad_name} App = atom() Dir = file:name_all()
paginator/1
Generates a paginator function for paginating a list of elements.
paginator(NElementPerPage) -> fun((Page, Objects) -> Objects) NElementPerPage = Page = non_neg_integer() Objects = [any()]
Example:
1> Page = paginator(3). 2> Page(2, [1,2,3,4,5,6,7,8,9]). [4,5,6]
paginate/3
Paginates a list of objects.
paginate(NElementPerPage, Objects, Page) -> Objects NElementPerPage = Page = non_neg_integer() Objects = [any()]
listener_bucket/1
Returns a running listener bucket that includes Handlers, Options and started date-time.
listener_bucket(Listener) -> Bucket | not_found Listener = http | https | spdy Bucket = #listener_bucket{}