Class: Fudge::OutputChecker
- Inherits:
-
Object
- Object
- Fudge::OutputChecker
- Defined in:
- lib/fudge/output_checker.rb
Overview
Task Output Checker
Instance Attribute Summary collapse
-
#checker ⇒ Object
readonly
Returns the value of attribute checker.
-
#formatter ⇒ Object
readonly
Returns the value of attribute formatter.
-
#match ⇒ Object
readonly
Returns the value of attribute match.
-
#pass_block ⇒ Object
readonly
Returns the value of attribute pass_block.
-
#regex ⇒ Object
readonly
Returns the value of attribute regex.
Instance Method Summary collapse
-
#check(output) ⇒ Object
Validates output against initialized checker.
-
#initialize(checker, formatter) ⇒ OutputChecker
constructor
A new instance of OutputChecker.
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
#checker ⇒ Object (readonly)
Returns the value of attribute checker.
3 4 5 |
# File 'lib/fudge/output_checker.rb', line 3 def checker @checker end |
#formatter ⇒ Object (readonly)
Returns the value of attribute formatter.
3 4 5 |
# File 'lib/fudge/output_checker.rb', line 3 def formatter @formatter end |
#match ⇒ Object (readonly)
Returns the value of attribute match.
3 4 5 |
# File 'lib/fudge/output_checker.rb', line 3 def match @match end |
#pass_block ⇒ Object (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 |
#regex ⇒ Object (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 |