Class: InstanceMatcher

Inherits:
Object show all
Defined in:
lib/maws/instance_matcher.rb

Class Method Summary collapse

Class Method Details

.matches?(instance, filters) ⇒ Boolean

Returns:

  • (Boolean)

2
3
4
5
6
7
8
9
10
11
12
# File 'lib/maws/instance_matcher.rb', line 2

def self.matches?(instance, filters)
  filters.each {|filter, expected_value|
    value = instance.send(filter)
    if value.is_a? Array
      return false if value.find_all {|v| value_matches?(v, expected_value)}.empty?
    else
      return false unless value_matches?(value, expected_value)
    end
  }
  true
end