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

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