Skip to content

Commit

Permalink
Use Kino.Render.Any.to_livebook/1
Browse files Browse the repository at this point in the history
Otherwise folks may copy and paste the contents
of this file, accidentally using Kino.Output's private
API. Relying on Kino.Render.Any is ok because that's
a public fallback.
  • Loading branch information
josevalim authored Feb 12, 2025
1 parent bfc8cb4 commit 51b1f12
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/kino/render.ex
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ end

defimpl Kino.Render, for: Any do
def to_livebook(term) do
Kino.Output.inspect(term)
Kino.Output.to_livebook(term)

Check warning on line 49 in lib/kino/render.ex

View workflow job for this annotation

GitHub Actions / main (1.15.5, 26.0.2, true)

Kino.Output.to_livebook/1 is undefined or private
end
end

defimpl Kino.Render, for: Kino.Inspect do
def to_livebook(raw) do
Kino.Output.inspect(raw.term)
Kino.Render.Any.to_livebook(raw.term)
end
end

Expand Down Expand Up @@ -164,7 +164,7 @@ defimpl Kino.Render, for: Reference do
reference |> Kino.ETS.new() |> Kino.Render.to_livebook()

true ->
Kino.Output.inspect(reference)
Kino.Render.Any.to_livebook(reference)
end
end

Expand Down Expand Up @@ -198,7 +198,7 @@ defimpl Kino.Render, for: Atom do
Kino.Render.to_livebook(tabs)

true ->
Kino.Output.inspect(atom)
Kino.Render.Any.to_livebook(atom)
end
end

Expand All @@ -220,7 +220,7 @@ defimpl Kino.Render, for: PID do
Kino.Render.to_livebook(tabs)

true ->
Kino.Output.inspect(pid)
Kino.Render.Any.to_livebook(pid)
end
end
end
Expand All @@ -229,7 +229,7 @@ defimpl Kino.Render, for: BitString do
def to_livebook(string) do
case Kino.Utils.get_image_type(string) do
nil ->
Kino.Output.inspect(string)
Kino.Render.Any.to_livebook(string)

type ->
raw = Kino.Inspect.new(string)
Expand Down

0 comments on commit 51b1f12

Please sign in to comment.