class FileReader::Excel

Contains the functionalities of reading Excel data

Attributes

data[R]

Public Class Methods

new(path, sht_name, col_name) click to toggle source
Calls superclass method Connector::ExcelReadConnector::new
# File lib/mylookup/reader.rb, line 11
def initialize(path, sht_name, col_name)
    super(path)
    @sht = @wb.sheet(sht_name)
    @col = col_name
    @data = nil
end

Public Instance Methods

read(match: {}, hide: {}, q_meth: :find) click to toggle source
# File lib/mylookup/reader.rb, line 18
def read(match: {}, hide: {}, q_meth: :find)
    aoa = @sht.parse(@col.to_sym => @col)
    @data = aoa.collect { |item| item[@col.to_sym].to_s.downcase }
    @data = @data.uniq
    return "Excel Data contains #{@data.size} row(s)\nExcel First Record => #{@data[0]}"
end