mfm/src/utils/breadcrumbs.cr

25 lines
480 B
Crystal
Raw Normal View History

2024-10-27 20:41:35 +01:00
# SPDX-License-Identifier: GPL-3.0-or-later
#
# SPDX-FileCopyrightText: 2024 Glenn Y. Rolland <glenux@glenux.net>
# Copyright © 2024 Glenn Y. Rolland <glenux@glenux.net>
module GX::Utils
class BreadCrumbs
def initialize(base : Array(String))
@ancestors = base
end
2024-01-24 00:28:46 +01:00
def +(other : String)
BreadCrumbs.new(@ancestors + [other])
end
2024-01-24 00:28:46 +01:00
def to_s(io : IO)
io << @ancestors.join(" ")
end
def to_a
@ancestors.clone
end
end
end