mfm/src/utils/breadcrumbs.cr

20 lines
308 B
Crystal
Raw Normal View History

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