Exploring Graphs with Elixir: case clause for already sliced graph.data string p25

The logic to determine if an ellipsis is shown will always evaluate to false because the variable str is already sliced and has a length equal to @slice

My 2p

  data =
    case String.length(str) < @slice do
      true ->
        @quote <> str <> @quote

      false ->
        str
        |> String.slice(0, @slice)
        |> (&(@quote <> &1 <> "..." <> @quote)).()
    end

We’re talking about the Inspect implementation for a graph struct, right?
The length of str can surely be less than a defined @slice value.

slice = 16
str = "magic broom"
str = str |> String.slice(0, slice)
String.length(str) < slice
=> true

Here’s my implementation which I believe I copied without mods

defimpl Inspect, for: __MODULE__ do
    @slice 16
    @quote <<?">>

    def inspect(%GraphCommons.Graph{} = graph, _opts) do
      type = graph.type
      file = @quote <> graph.file <> @quote

      str =
        graph.data
        |> String.replace("\n", "\\n")
        |> String.replace(@quote, "\\" <> @quote)
        |> String.slice(0, @slice)

      data =
        case String.length(str) < @slice do
          true -> @quote <> str <> @quote
          false -> @quote <> str <> "..." <> @quote
        end

      "#GraphCommons.Graph<type: #{type}, file: #{file}, data: #{data}>"
    end
  end