Class: BuildEm::ConditionMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/buildem/condition_matcher.rb

Instance Method Summary collapse

Instance Method Details

#match(return_code, output, condition) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/buildem/condition_matcher.rb', line 2

def match(return_code, output, condition)
  case condition
  when Regexp
    return false unless output =~ condition
  when String
    return false unless output == condition
  when Fixnum
    return false unless return_code == condition
  else
    raise "unsupported type for condition"
  end
  return true
end