Skip to content

Commit

Permalink
Fix deprecation warning (lexmag#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
scohen authored and lexmag committed Oct 2, 2017
1 parent e075715 commit f7d5916
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/statix/conn.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ defmodule Statix.Conn do
alias Statix.Packet

def new(host, port) when is_binary(host) do
new(String.to_char_list(host), port)
new(string_to_charlist(host), port)
end

def new(host, port) when is_list(host) or is_tuple(host) do
Expand All @@ -32,4 +32,10 @@ defmodule Statix.Conn do
{:inet_reply, _port, status} -> status
end
end

if Version.match?(System.version(), ">= 1.3.0") do
defp string_to_charlist(string), do: String.to_charlist(string)
else
defp string_to_charlist(string), do: String.to_char_list(string)
end
end

0 comments on commit f7d5916

Please sign in to comment.