lib/linked/list.rb
def inspect_list(&block)
      res = [block_given? ? yield(self) : object_identifier]

      each_item do |item|
        lines = item.inspect(&block).split "\n"

        res.push((item.last? ? '└─╴' : '├─╴') + lines.shift)
        padding = item.last? ? '   ' : '│  '
        lines.each { |line| res.push padding + line }
      end

      res.join("\n")
    end
def inspect_list(&block)
      res = [block_given? ? yield(self) : object_identifier]

      each_item do |item|
        lines = item.inspect(&block).split "\n"

        res.push((item.last? ? '└─╴' : '├─╴') + lines.shift)
        padding = item.last? ? '   ' : '│  '
        lines.each { |line| res.push padding + line }
      end

      res.join("\n")
    end
def inspect_list ( & block ) res = [ block_given? ? yield ( self ) : object_identifier ] each_item do | item | lines = item . inspect ( block ) . split "\n" res . push ( ( item . last? ? '└─╴' : '├─ '  + lines.sh i t padding = item . last? ? '   ' : '   ' lines . each { | line | res . push padding + line } end res . join ( "\n" ) end
Overrides the default inspect method to provide a more useful view of the
 list.

 Importantly this implementation supports nested lists and will return a
 tree like structure.
Overrides the default inspect method to provide a more useful view of the list .