Class: FileWriter::Excel

Inherits:
Connector::ExcelWriteConnector show all
Defined in:
lib/mylookup/writer.rb

Overview

Contains the functionalities of writing data in Excel

Instance Attribute Summary

Attributes inherited from Connector::ExcelWriteConnector

#wb, #ws

Instance Method Summary collapse

Constructor Details

#initialize(path, data, header) ⇒ Excel

Returns a new instance of Excel.



10
11
12
13
14
# File 'lib/mylookup/writer.rb', line 10

def initialize(path, data, header)
    super(path)
    @data = data
    @header = header
end

Instance Method Details

#writeObject



16
17
18
19
20
21
22
23
24
25
# File 'lib/mylookup/writer.rb', line 16

def write
    puts "Writing Data in Excel"
    begin
        write_header
        write_data
    rescue StandardError => err
        puts "[Error]: Error occured while writing in Excel!!!"
        puts err
    end
end