Class: Confire::Processor
- Inherits:
-
Object
- Object
- Confire::Processor
- Defined in:
- lib/confire/processor.rb
Overview
This is where the main bits are processed
We can process lines and blocks here
Instance Attribute Summary collapse
-
#custom_processor ⇒ Object
Returns the value of attribute custom_processor.
-
#logger ⇒ Object
Returns the value of attribute logger.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Processor
constructor
A new instance of Processor.
-
#process_block(line_buffer, test_number) ⇒ Object
Will process a test case.
-
#process_line(line) ⇒ Object
Process the line Each of these lines get stored as an element in the line_buffer array line: the line the process.
Constructor Details
#initialize(options = {}) ⇒ Processor
Returns a new instance of Processor.
7 8 9 10 11 |
# File 'lib/confire/processor.rb', line 7 def initialize( = {}) @logger = [:logger] @custom_processor = [:custom_processor] @custom_processor.logger = @logger if @custom_processor end |
Instance Attribute Details
#custom_processor ⇒ Object
Returns the value of attribute custom_processor.
5 6 7 |
# File 'lib/confire/processor.rb', line 5 def custom_processor @custom_processor end |
#logger ⇒ Object
Returns the value of attribute logger.
5 6 7 |
# File 'lib/confire/processor.rb', line 5 def logger @logger end |
Instance Method Details
#process_block(line_buffer, test_number) ⇒ Object
Will process a test case. Just return whatever we want to print out as results. line_buffer: an array of inputs. each line read is an element in the array test_number: the current test case number we are working on. probably won’t need this value
17 18 19 20 21 22 23 |
# File 'lib/confire/processor.rb', line 17 def process_block(line_buffer, test_number) if (@custom_processor && @custom_processor.class.method_defined?(:process_testcase)) @custom_processor.process_testcase line_buffer else line_buffer end end |
#process_line(line) ⇒ Object
Process the line
Each of these lines get stored as an element in the line_buffer array
line: the line the process
28 29 30 31 32 33 34 |
# File 'lib/confire/processor.rb', line 28 def process_line(line) if (@custom_processor && @custom_processor.class.method_defined?(:process_line)) @custom_processor.process_line line else line.split ' ' end end |