LowEndInsight v0.3.0 Helpers View Source

Collection of generic helper functions.

Link to this section Summary

Functions

get_slug/1: extracts the slug from the provided URI argument and returns the path

split_slug/1: splits apart the username and repo from a git slug returning discrete stings.

Link to this section Functions

Link to this function

count_forward_slashes(url)

View Source

get_slug/1: extracts the slug from the provided URI argument and returns the path

Example

iex(1)> {:ok, slug} = Helpers.get_slug("https://github.com/kitplummer/xmpprails")
{:ok, "kitplummer/xmpprails"}
iex(2)> slug
"kitplummer/xmpprails"

split_slug/1: splits apart the username and repo from a git slug returning discrete stings.

Examples

iex(6)> {:ok, org, repo}  = Helpers.split_slug("kitplummer/xmpprails")
{:ok, "kitplummer", "xmpprails"}
iex(7)> org
"kitplummer"
iex(8)> repo
"xmpprails"