Class: Fudge::OutputChecker

Inherits:
Object
  • Object
show all
Defined in:
lib/fudge/output_checker.rb

Overview

Task Output Checker

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(checker, formatter) ⇒ OutputChecker

Returns a new instance of OutputChecker.



5
6
7
8
# File 'lib/fudge/output_checker.rb', line 5

def initialize(checker, formatter)
  @checker = checker
  @formatter = formatter
end

Instance Attribute Details

#checkerObject (readonly)

Returns the value of attribute checker.



3
4
5
# File 'lib/fudge/output_checker.rb', line 3

def checker
  @checker
end

#formatterObject (readonly)

Returns the value of attribute formatter.



3
4
5
# File 'lib/fudge/output_checker.rb', line 3

def formatter
  @formatter
end

#matchObject (readonly)

Returns the value of attribute match.



3
4
5
# File 'lib/fudge/output_checker.rb', line 3

def match
  @match
end

#pass_blockObject (readonly)

Returns the value of attribute pass_block.



3
4
5
# File 'lib/fudge/output_checker.rb', line 3

def pass_block
  @pass_block
end

#regexObject (readonly)

Returns the value of attribute regex.



3
4
5
# File 'lib/fudge/output_checker.rb', line 3

def regex
  @regex
end

Instance Method Details

#check(output) ⇒ Object

Validates output against initialized checker



11
12
13
14
15
# File 'lib/fudge/output_checker.rb', line 11

def check(output)
  return true unless checker # We're ok if no output defined
  extract_matchers
  matches?(output) && block_passes?
end