Skip to content

Commit 3ccf54b

Browse files
committed
update show methods
1 parent 8725354 commit 3ccf54b

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/tuplevector.jl

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,19 @@ function Base.showarg(io::IO, tv::TupleVector{T}, toplevel) where T
6060
toplevel && println(io, " with schema ", schema(T))
6161
end
6262

63-
function Base.show(io::IO, ::MIME"text/plain", tv::TupleVector)
63+
Base.show(io::IO, ::MIME"text/plain", tv::TupleVector) = show(io, tv)
64+
Base.show(io::IO, ::MIME"text/html", tv::TupleVector) = show(io, tv)
65+
66+
function Base.show(io::IO, tv::TupleVector)
6467
summary(io, tv)
6568
print(io, summarize(tv))
6669
end
6770

68-
function Base.show(io::IO, ::MIME"text/html", tv::TupleVector)
69-
summary(io, tv)
70-
print(io, summarize(tv))
71+
function Base.show(io::IO, ::MIME"text/plain", v::Vector{TV}) where {TV <: TupleVector}
72+
io = IOContext(io, :compact => true)
73+
n = length(v)
74+
println(io, n,"-element Vector{$TV}")
75+
foreach(v) do tv println(io, summarize(tv)) end
7176
end
7277

7378
function Base.getindex(x::TupleVector, j)
@@ -97,6 +102,7 @@ function Base.size(tv::TupleVector)
97102
size(flatten(unwrap(tv))[1])
98103
end
99104

105+
100106
# TODO: Make this pass @code_warntype
101107
Base.getproperty(tv::TupleVector, k::Symbol) = maybewrap(getproperty(unwrap(tv), k))
102108

0 commit comments

Comments
 (0)