Skip to content

Commit

Permalink
Add build_absolute_urls in Crawly.Utils module
Browse files Browse the repository at this point in the history
  • Loading branch information
oltarasenko committed Aug 10, 2019
1 parent 0f983a0 commit df7e0df
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/crawly/utils.ex
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ defmodule Crawly.Utils do
URI.merge(base_url, url) |> to_string()
end

@doc """
A helper function which joins relative url with a base URL for a list
"""
@spec build_absolute_urls([binary()], binary()) :: [binary()]
def build_absolute_urls(urls, base_url) do
Enum.map(urls, fn url -> URI.merge(base_url, url) |> to_string() end)
end

@doc """
Pipeline/Middleware helper
Expand Down

0 comments on commit df7e0df

Please sign in to comment.