Sha256: a419fa410284b39ffeb39e77a42a6954b4806741ab1a70f6b6181f16a0dfad34
Contents?: true
Size: 750 Bytes
Versions: 2
Compression:
Stored size: 750 Bytes
Contents
module Trestle class Breadcrumb attr_reader :label, :path def initialize(label, path=nil) @label, @path = label, path end def ==(other) label == other.label && path == other.path end class Trail include Enumerable def initialize(breadcrumbs=[]) @breadcrumbs = Array(breadcrumbs) end def ==(other) to_a == other.to_a end def dup self.class.new(@breadcrumbs.dup) end def append(label, path=nil) @breadcrumbs << Breadcrumb.new(label, path) end def prepend(label, path=nil) @breadcrumbs.unshift(Breadcrumb.new(label, path)) end delegate :each, :first, :last, to: :@breadcrumbs end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
trestle-0.8.5 | lib/trestle/breadcrumb.rb |
trestle-0.8.4 | lib/trestle/breadcrumb.rb |