Skip to content

Commit

Permalink
Add Snapshot.unwrap/1 for getting raw snapshot lines
Browse files Browse the repository at this point in the history
  • Loading branch information
ku1ik committed Apr 21, 2024
1 parent cd7350d commit 5aff18c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 1 addition & 4 deletions lib/asciinema/recordings.ex
Original file line number Diff line number Diff line change
Expand Up @@ -405,10 +405,7 @@ defmodule Asciinema.Recordings do

{lines, cursor}
|> Snapshot.new()
|> Map.get(:lines)
|> Enum.map(fn segments ->
Enum.map(segments, &Tuple.to_list/1)
end)
|> Snapshot.unwrap()
end

def title(asciicast) do
Expand Down
6 changes: 6 additions & 0 deletions lib/asciinema/recordings/snapshot.ex
Original file line number Diff line number Diff line change
Expand Up @@ -321,4 +321,10 @@ defmodule Asciinema.Recordings.Snapshot do

%{y: y, segments: Enum.reverse(segments)}
end

def unwrap(%__MODULE__{lines: lines}) do
Enum.map(lines, fn segments ->
Enum.map(segments, &Tuple.to_list/1)
end)
end
end

0 comments on commit 5aff18c

Please sign in to comment.