commit: 2266370ebf9e38a774d2d7902038b9bff4f275cc
parent: 0110f8e9f0d527cb620ddf44e6f79b9f95b3f560
Author: Egor Kislitsyn <egor@kislitsyn.com>
Date: Fri, 8 Feb 2019 16:43:06 +0700
polish off api
Diffstat:
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/auto_linker.ex b/lib/auto_linker.ex
@@ -59,7 +59,7 @@ defmodule AutoLinker do
Note that passing opts to `link/2` will override the configuration settings.
"""
def link(text, opts \\ []) do
- parse({text, nil}, opts) |> elem(0)
+ parse(text, opts)
end
def link_map(text, acc, opts \\ []) do
diff --git a/lib/auto_linker/parser.ex b/lib/auto_linker/parser.ex
@@ -66,6 +66,7 @@ defmodule AutoLinker.Parser do
@default_opts ~w(url)a
def parse(input, opts \\ %{})
+ def parse(input, opts) when is_binary(input), do: parse({input, nil}, opts) |> elem(0)
def parse(input, list) when is_list(list), do: parse(input, Enum.into(list, %{}))
def parse(input, opts) do