Module: VagrantPlugins::OVirtProvider::Util::Collection

Defined in:
lib/vagrant-ovirt/util/collection.rb

Class Method Summary collapse

Class Method Details

.find_matching(collection, name) ⇒ Object

This method finds a matching thing in a collection of things. This works matching if the ID or NAME equals to ‘name`. Or, if `name` is a regexp, a partial match is chosen as well.



9
10
11
12
13
14
15
16
# File 'lib/vagrant-ovirt/util/collection.rb', line 9

def self.find_matching(collection, name)
  collection.each do |single|
    return single if single.name == name
    return single if single.id == name
  end

  nil
end