2024-01-14 20:31:38 +01:00
|
|
|
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])
|
2024-01-14 20:31:38 +01:00
|
|
|
end
|
|
|
|
|
2024-01-24 00:28:46 +01:00
|
|
|
def to_s(io : IO)
|
|
|
|
io << @ancestors.join(" ")
|
2024-01-14 20:31:38 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def to_a
|
|
|
|
@ancestors.clone
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|