Class: Processor
- Inherits:
-
Object
- Object
- Processor
- Defined in:
- lib/makesheets/processor.rb
Overview
Maps the matched data into the original base file
Instance Method Summary collapse
-
#initialize(options) ⇒ Processor
constructor
A new instance of Processor.
-
#process ⇒ Object
Executes the process.
Constructor Details
#initialize(options) ⇒ Processor
Returns a new instance of Processor.
10 11 12 13 14 15 16 17 18 |
# File 'lib/makesheets/processor.rb', line 10 def initialize() @infile = [:infile] @outfile = [:outfile] || make_desti_file_name @source_sht = [:sheet] || 0 @skiprows = [:skiprows] || 0 @readrows = [:readrows] @shtcol = [:column] @prefix = [:prefix] end |
Instance Method Details
#process ⇒ Object
Executes the process
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/makesheets/processor.rb', line 29 def process puts "[Info]: Process initiated..." @source = ExcelReader.new(@infile, @source_sht, @skiprows, @readrows, @shtcol) unless column_exists? # Validates if the makesheet column exists begin raise ColumnNotFoundError.new(@shtcol, @infile) rescue => e puts "#{e.column} column does not exist in #{e.filename}!!!" end exit end @source.read ExcelWriter.new(@outfile, @source, @shtcol, @prefix).write end |