Sha256: c4a8cc6b2e04e24864264e99069437839a86762cac7e40b2937a799343e25f71
Contents?: true
Size: 608 Bytes
Versions: 63
Compression:
Stored size: 608 Bytes
Contents
module GovukTechDocs module TableOfContents class HeadingTree attr_accessor :parent, :heading, :children def initialize(parent: nil, heading: nil, children: []) @parent = parent @heading = heading @children = children end def depth if parent parent.depth + 1 else 1 end end def ==(other) heading == other.heading && children.length == other.children.length && children.map.with_index { |child, index| child == other.children[index] }.all? end end end end
Version data entries
63 entries across 63 versions & 2 rubygems