Sha256: 47589d3475b8687d810b0c79b338eca7c108ac0c279ab9d455f14109b768f30a

Contents?: true

Size: 630 Bytes

Versions: 3

Compression:

Stored size: 630 Bytes

Contents

require_relative 'gem'
require_relative 'declaration'

module Pessimize
  class GemCollection
    attr_reader :gems, :declarations

    def initialize
      @gems = Hash.new do |hash, missing|
        hash[missing] = []
      end
      @declarations = []
    end

    def add_gem(*args)
      add_grouped_gem(:global, *args)
    end

    def add_grouped_gem(group, *args)
      self.gems[group] << Gem.new(*args)
    end

    def add_declaration(name, *args)
      self.declarations << Declaration.new(name, *args)
    end

    def all
      gems.values.flatten
    end

  protected
    attr_writer :gems, :declarations
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pessimize-0.1.0 lib/pessimize/gem_collection.rb
pessimize-0.0.3 lib/pessimize/gem_collection.rb
pessimize-0.0.2 lib/pessimize/gem_collection.rb