Sha256: 23fb12c15df251507ea83a09796702b17741838995bebe9c559025789169b40b
Contents?: true
Size: 496 Bytes
Versions: 9
Compression:
Stored size: 496 Bytes
Contents
class Geminabox::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 @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
9 entries across 9 versions & 1 rubygems