Sha256: a707516a3d37c6d9d3b826889e53b04b0f0fcf93ce5c9b2861e109377aa43c0d
Contents?: true
Size: 833 Bytes
Versions: 31
Compression:
Stored size: 833 Bytes
Contents
# frozen_string_literal: true require 'eac_ruby_utils/core_ext' module EhbrsRubyUtils class CircularListSpreader require_sub __FILE__ common_constructor :items # @return [EhbrsRubyUtils::SpreaderT1::GroupLevel] def build_root r = ::EhbrsRubyUtils::CircularListSpreader::GroupLevel.new('ROOT') items.each { |item| r.push(item.to_circular_list_spreader_path, item) } r end # @return [Array] def result base_list = ::EhbrsRubyUtils::CircularListSpreader::List.empty build_root.pop_all.each do |item| base_list = lists_with_item(base_list, item).max end base_list.items.map(&:item) end def lists_with_item(base_list, item) (base_list.count + 1).times.map do |position| base_list.insert(position, item) end end end end
Version data entries
31 entries across 31 versions & 1 rubygems