Skip to content

Commit

Permalink
Merge pull request #4 from seomoz/myron/stop-supporting-nil
Browse files Browse the repository at this point in the history
Remove support for `nil` input.
  • Loading branch information
myronmarston committed Apr 18, 2016
2 parents bab7171 + 0cef763 commit 0ff84c8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions lib/public_suffix.ex
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@ defmodule PublicSuffix do
iex> registrable_domain("foo.github.io")
"foo.github.io"
"""
@spec registrable_domain(nil | String.t) :: nil | String.t
@spec registrable_domain(nil | String.t, ignore_private: boolean) :: nil | String.t
def registrable_domain(domain, options \\ [ignore_private: false])
def registrable_domain(nil, _), do: nil
def registrable_domain(domain, options) do
@spec registrable_domain(String.t) :: nil | String.t
@spec registrable_domain(String.t, ignore_private: boolean) :: nil | String.t
def registrable_domain(domain, options \\ [ignore_private: false]) when is_binary(domain) do
domain
# "The domain...must be canonicalized in the normal way for hostnames - lower-case"
|> String.downcase
Expand Down
2 changes: 1 addition & 1 deletion test/generated_cases_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ defmodule PublicSuffixGeneratedCasesTest do
use ExUnit.Case
import PublicSuffix

for test_case <- PublicSuffix.TestCaseGenerator.test_cases do
for test_case <- PublicSuffix.TestCaseGenerator.test_cases, test_case.input do
@test_case test_case
expression = "registrable_domain(#{inspect test_case.input}) == #{inspect test_case.output}"
description = "#{test_case.group_description} ##{test_case.group_case_number} -- line #{test_case.line_number}"
Expand Down

0 comments on commit 0ff84c8

Please sign in to comment.