Sha256: ac3d596a65984ada7b4795e6aa560a676698b6d90fb84ae65556cce20699775b

Contents?: true

Size: 527 Bytes

Versions: 4

Compression:

Stored size: 527 Bytes

Contents

class GeminaboxSecure::GemVersionCollection
  include Enumerable

  def initialize(initial_gems = [])
    @gems = Hash.new{|h,k| h[k] = [] }
    initial_gems.each{|g| self << g }
  end

  def <<(gemdef)
    name,version,_ = gemdef
    return self if name.nil?
    @gems[name] += [version].flatten
    @gems[name].sort!
    self
  end

  def + other
    other.inject(self.class.new(self)){|new_set, gemdef|
      new_set << gemdef
    }
  end

  def each(&block)
    @gems.sort_by{|name, versions| name }.each(&block)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
geminabox-secure-0.3.7 lib/geminabox-secure/gem_version_collection.rb
geminabox-secure-0.3.6 lib/geminabox-secure/gem_version_collection.rb
geminabox-secure-0.3.5 lib/geminabox-secure/gem_version_collection.rb
geminabox-secure-0.3.4 lib/geminabox-secure/gem_version_collection.rb