Sha256: 0ab3ae456b9f519e6dbe2ff48e58f98cbb190ee1df4f0fa7bad2f4f5739f49d8

Contents?: true

Size: 781 Bytes

Versions: 13

Compression:

Stored size: 781 Bytes

Contents

#--
# (c) Copyright 2007-2008 Sun Microsystems, Inc.
# See the file LICENSES.txt included with the distribution for
# software license details.
#++

module Warbler
  # A set of gems. This only exists to allow expected operations
  # to be used to add gems, and for backwards compatibility.
  # It would be easier to just use a hash.
  class Gems < Hash
    ANY_VERSION = nil
    
    def initialize(gems = nil)
      if gems.is_a?(Hash)
        self.merge!(gems)
      elsif gems.is_a?(Array)
        gems.each {|gem| self << gem }
      end
    end
    
    def <<(gem)
      self[gem] ||= ANY_VERSION
    end

    def +(other)
      other.each {|g| self[g] ||= ANY_VERSION }
      self
    end

    def -(other)
      other.each {|g| self.delete(g)}
      self
    end
  end
end

Version data entries

13 entries across 13 versions & 7 rubygems

Version Path
aslakhellesoy-warbler-0.9.12 lib/warbler/gems.rb
aslakhellesoy-warbler-0.9.13.4 lib/warbler/gems.rb
aslakhellesoy-warbler-0.9.13 lib/warbler/gems.rb
bekkopen-warbler-0.9.13.1 lib/warbler/gems.rb
finnlabs-warbler-0.9.14 lib/warbler/gems.rb
fjc-warbler-0.9.12 lib/warbler/gems.rb
manalang-warbler-0.9.12.1 lib/warbler/gems.rb
nicksieger-warbler-0.9.12 lib/warbler/gems.rb
nicksieger-warbler-0.9.13 lib/warbler/gems.rb
nicksieger-warbler-0.9.14 lib/warbler/gems.rb
warbler-0.9.14 lib/warbler/gems.rb
warbler-0.9.12 lib/warbler/gems.rb
warbler-0.9.13 lib/warbler/gems.rb