Skip to content

Commit 9a27b7d

Browse files
author
Awlex
committed
check that all items are atoms
1 parent 67f7e8b commit 9a27b7d

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

lib/kaffy/resource_schema.ex

+1-3
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ defmodule Kaffy.ResourceSchema do
210210
is_binary(value) ->
211211
String.slice(value, 0, 140)
212212

213-
is_list(value) ->
213+
is_list(value) and Enum.any?(value, &is_atom/1) ->
214214
pretty_list(value)
215215

216216
true ->
@@ -323,9 +323,7 @@ defmodule Kaffy.ResourceSchema do
323323
end
324324

325325
defp pretty_list([]), do: ""
326-
defp pretty_list([item] = list) when not is_binary(item), do: list
327326
defp pretty_list([item]), do: to_string(item)
328-
defp pretty_list([a | _rest] = list) when not is_binary(a), do: list
329327
defp pretty_list([a, b]), do: "#{a} and #{b}"
330328
defp pretty_list([a, b, c]), do: "#{a}, #{b} and #{c}"
331329
defp pretty_list([a, b, c, d]), do: "#{a}, #{b}, #{c} and #{d}"

0 commit comments

Comments
 (0)