Sha256: 8ce9affac86e79a62ed127730c42c8aec4217b176e1e72536f1e9708681a780e

Contents?: true

Size: 615 Bytes

Versions: 16

Compression:

Stored size: 615 Bytes

Contents

module Kuby
  module Docker
    class PackageList
      include Enumerable

      attr_reader :packages

      def initialize(package_tuples)
        @packages = []
        package_tuples.each { |pt| add(*pt) }
      end

      def [](name)
        packages.find { |pkg| pkg.name == name }
      end

      def add(name, version = nil)
        packages << Package.new(name, version)
      end

      def delete(name)
        packages.delete_if { |pkg| pkg.name == name }
      end

      def each(&block)
        packages.each(&block)
      end

      def empty?
        packages.empty?
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
kuby-core-0.10.1 lib/kuby/docker/package_list.rb
kuby-core-0.10.0 lib/kuby/docker/package_list.rb
kuby-core-0.9.1 lib/kuby/docker/package_list.rb
kuby-core-0.9.0 lib/kuby/docker/package_list.rb
kuby-core-0.8.1 lib/kuby/docker/package_list.rb
kuby-core-0.8.0 lib/kuby/docker/package_list.rb
kuby-core-0.7.2 lib/kuby/docker/package_list.rb
kuby-core-0.7.1 lib/kuby/docker/package_list.rb
kuby-core-0.7.0 lib/kuby/docker/package_list.rb
kuby-core-0.6.1 lib/kuby/docker/package_list.rb
kuby-core-0.6.0 lib/kuby/docker/package_list.rb
kuby-core-0.5.0 lib/kuby/docker/package_list.rb
kuby-core-0.4.0 lib/kuby/docker/package_list.rb
kuby-core-0.3.0 lib/kuby/docker/package_list.rb
kuby-core-0.2.0 lib/kuby/docker/package_list.rb
kuby-core-0.1.0 lib/kuby/docker/package_list.rb