Sha256: 511fcee0cffe0fcded4073be644b0952f9c973d09bd1f57a59b1405a1272471c

Contents?: true

Size: 440 Bytes

Versions: 19

Compression:

Stored size: 440 Bytes

Contents

module Geminabox
  class GemListMerge
    attr_accessor :list

    IGNORE_DEPENDENCIES = 0..-2

    def self.from(*lists)
      lists.map{|list| new(list)}.inject(:merge)
    end

    def initialize(list)
      @list = list
    end

    def merge(other)
      merged = (list + other.list)
      merged.uniq! {|val| val.values[IGNORE_DEPENDENCIES] }
      merged.sort_by! {|x| x.values[IGNORE_DEPENDENCIES] }
      merged
    end

  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
geminabox-1.2.0 lib/geminabox/gem_list_merge.rb
geminabox-1.1.1 lib/geminabox/gem_list_merge.rb
geminabox-1.1.0 lib/geminabox/gem_list_merge.rb
geminabox-1.0.1 lib/geminabox/gem_list_merge.rb
geminabox-1.0.0 lib/geminabox/gem_list_merge.rb
geminabox-0.13.15 lib/geminabox/gem_list_merge.rb
geminabox-0.13.14 lib/geminabox/gem_list_merge.rb
geminabox-0.13.13 lib/geminabox/gem_list_merge.rb
geminabox-0.13.11 lib/geminabox/gem_list_merge.rb
geminabox-0.13.10 lib/geminabox/gem_list_merge.rb
geminabox-0.13.9 lib/geminabox/gem_list_merge.rb
geminabox-0.13.8 lib/geminabox/gem_list_merge.rb
geminabox-0.13.7 lib/geminabox/gem_list_merge.rb
geminabox-0.13.6 lib/geminabox/gem_list_merge.rb
geminabox-0.13.5 lib/geminabox/gem_list_merge.rb
geminabox-0.13.4 lib/geminabox/gem_list_merge.rb
geminabox-0.13.3 lib/geminabox/gem_list_merge.rb
geminabox-0.13.2 lib/geminabox/gem_list_merge.rb
geminabox-0.13.1 lib/geminabox/gem_list_merge.rb