Sha256: 501e7ed0fb798d19fea26f117e65a79b1d8929958be997d5bb6190413255f065
Contents?: true
Size: 668 Bytes
Versions: 13
Compression:
Stored size: 668 Bytes
Contents
# frozen_string_literal: true module DevSuite module DirectoryTree module Node class Directory < Base attr_reader :children def initialize(name) super @children = [] end def directory? true end def add_child(node) @children << node sort_children! end private def sort_children! @children.sort_by! do |node| [ node.hidden? ? 1 : 0, # Hidden nodes should be at the end node.name.downcase, # Alphabetical order ] end end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems