Class: Pal::Operation::CSVProcessor

Inherits:
Object
  • Object
show all
Includes:
Log
Defined in:
lib/pal/handler/processor.rb

Overview

Base class for CSV impls, we can define strategy on memory usage needs based on potential issues from file size. TODO: We probably want to break away from this being a “CSV”-only file type later Needs more thinking

Direct Known Subclasses

RCSVProcessorImpl

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Log

#log_debug, #log_error, #log_info, #log_warn

Constructor Details

#initialize(csv_file_location) ⇒ CSVProcessor

Returns a new instance of CSVProcessor.



25
26
27
# File 'lib/pal/handler/processor.rb', line 25

def initialize(csv_file_location)
  @csv_file_location = csv_file_location
end

Instance Attribute Details

#csv_file_locationObject

Returns the value of attribute csv_file_location.



23
24
25
# File 'lib/pal/handler/processor.rb', line 23

def csv_file_location
  @csv_file_location
end

Class Method Details

.retrieve_default_processor(csv_file_location) ⇒ BaseCSVProcessor

Strategy to return correct type - memory or performance focused.

Returns:

  • (BaseCSVProcessor)


18
19
20
21
# File 'lib/pal/handler/processor.rb', line 18

def self.retrieve_default_processor(csv_file_location)
  Pal.logger.info("Default processor has been requested. No further action required.")
  RCSVProcessorImpl.new(csv_file_location)
end

Instance Method Details

#parse(ctx, opts = {}, &block) ⇒ Object

Parameters:



32
33
34
# File 'lib/pal/handler/processor.rb', line 32

def parse(ctx, opts={}, &block)
  _parse_impl(ctx, opts, &block)
end