Class: Cure::Export::BaseProcessor
- Inherits:
-
Object
- Object
- Cure::Export::BaseProcessor
- Includes:
- Log
- Defined in:
- lib/cure/export/base_processor.rb
Direct Known Subclasses
ChunkCsvProcessor, CsvProcessor, TerminalProcessor, YieldRowProcessor
Instance Attribute Summary collapse
-
#named_range ⇒ Object
readonly
Returns the value of attribute named_range.
Instance Method Summary collapse
- #cleanup ⇒ Object
-
#initialize(named_range, opts) ⇒ BaseProcessor
constructor
A new instance of BaseProcessor.
- #process(_row) ⇒ Object
- #process_row(row) ⇒ Object
- #setup ⇒ Object
Methods included from Log
#log_debug, #log_error, #log_info, #log_trace, #log_warn
Constructor Details
#initialize(named_range, opts) ⇒ BaseProcessor
Returns a new instance of BaseProcessor.
14 15 16 17 18 19 20 |
# File 'lib/cure/export/base_processor.rb', line 14 def initialize(named_range, opts) @named_range = named_range @opts = opts @limit_rows = opts.fetch(:limit_rows, nil) @processed = 0 end |
Instance Attribute Details
#named_range ⇒ Object (readonly)
Returns the value of attribute named_range.
12 13 14 |
# File 'lib/cure/export/base_processor.rb', line 12 def named_range @named_range end |
Instance Method Details
#cleanup ⇒ Object
38 39 40 |
# File 'lib/cure/export/base_processor.rb', line 38 def cleanup raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}'" end |
#process(_row) ⇒ Object
30 31 32 |
# File 'lib/cure/export/base_processor.rb', line 30 def process(_row) raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}'" end |
#process_row(row) ⇒ Object
23 24 25 26 27 |
# File 'lib/cure/export/base_processor.rb', line 23 def process_row(row) process(row) unless @limit_rows && @limit_rows <= @processed @processed += 1 end |
#setup ⇒ Object
34 35 36 |
# File 'lib/cure/export/base_processor.rb', line 34 def setup raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}'" end |