Class: Docker::Compose::Collection

Inherits:
Array
  • Object
show all
Defined in:
lib/docker/compose/collection.rb

Instance Method Summary collapse

Instance Method Details

#whereObject

Examples:

find containers that are up

who_is_up = coll.where { |c| c.up? }

count space taken by all containers

coll.map { |c| c.size }.inject(0) { |a, x| a + x }


7
8
9
10
11
# File 'lib/docker/compose/collection.rb', line 7

def where
  hits = Collection.new
  self.each { |c| hits << c if yield(c) }
  hits
end