Skip to content

Commit

Permalink
Removes warning about hidden being undefined
Browse files Browse the repository at this point in the history
Why:

* When compiling a view that used this module it would throw a warning
  saying that `hidden/0` was undefined

This change addresses the need by:

* Tricking the compiler to now throw the warning since we know that it
  will be defined as we're only calling it conditionally on the fact that
  it has been overridden.
  • Loading branch information
zamith committed Oct 2, 2018
1 parent 242499e commit 8c19660
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/jsonapi/view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ defmodule JSONAPI.View do
hidden =
if Enum.member?(__MODULE__.__info__(:functions), {:hidden, 0}) do
Deprecation.warn(:hidden)
__MODULE__.hidden()
this = __MODULE__
this.hidden()
else
hidden(data)
end
Expand Down

0 comments on commit 8c19660

Please sign in to comment.