Class: BigBench::PostProcessor::Processor

Inherits:
Object
  • Object
show all
Includes:
ActionView::Helpers
Defined in:
lib/bigbench/post_processor.rb

Overview

A single processor, be it a block or a module is always mapped into this class

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(processor = nil, options = {}, &block) ⇒ Processor

Creates the processor with the block or a processor



70
71
72
73
# File 'lib/bigbench/post_processor.rb', line 70

def initialize(processor = nil, options = {}, &block)
  @proc = processor_to_proc(processor) || block
  @runs, @options = 0, options
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



67
68
69
# File 'lib/bigbench/post_processor.rb', line 67

def options
  @options
end

#procObject

Returns the value of attribute proc.



65
66
67
# File 'lib/bigbench/post_processor.rb', line 65

def proc
  @proc
end

#runsObject

Returns the value of attribute runs.



66
67
68
# File 'lib/bigbench/post_processor.rb', line 66

def runs
  @runs
end

Instance Method Details

#run!Object

Run the block of code or the run! method of the processor



76
77
78
79
# File 'lib/bigbench/post_processor.rb', line 76

def run!
  @runs += 1
  Context.module_exec(@options, &@proc)
end