Sha256: 59bf0a301700d870664127a093279274a5e63dadcca8ca045275c39701682dd7

Contents?: true

Size: 629 Bytes

Versions: 3

Compression:

Stored size: 629 Bytes

Contents

module Rocktumbler
  class GroupFilter
    def initialize(gem_dependencies)
      @gem_dependencies = gem_dependencies
    end

    def filter
      gems_by_group = @gem_dependencies.group_by(&:groups)

      default_gems = gems_by_group.delete([:default])
      default_gems.sort!
      groups = [Rocktumbler::Group.new(:default,default_gems)]

      gems_by_group.each do | group, gems |
        gems_unique_to_group = gems - default_gems
        gems_unique_to_group.sort!
        gems_unique_to_group.uniq!
        groups << Rocktumbler::Group.new(group,gems_unique_to_group)
      end

      return groups
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rocktumbler-0.1.2 lib/rocktumbler/group_filter.rb
rocktumbler-0.1.1 lib/rocktumbler/group_filter.rb
rocktumbler-0.1.0 lib/rocktumbler/group_filter.rb