Class: Connector::ExcelReadConnector

Inherits:
Object
  • Object
show all
Defined in:
lib/mylookup/connector.rb

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ ExcelReadConnector

Returns a new instance of ExcelReadConnector.



38
39
40
41
42
# File 'lib/mylookup/connector.rb', line 38

def initialize(path)
    @path = path
    @wb = Roo::Excelx.new(@path) 
    @sheets = @wb.sheets
end

Instance Method Details

#column_exists?(sht, col_name) ⇒ Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/mylookup/connector.rb', line 48

def column_exists? sht, col_name 
    @wb.sheet(sht).row(1).include? col_name
end

#sheet_exists?(sht_name) ⇒ Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/mylookup/connector.rb', line 44

def sheet_exists? sht_name
    @sheets.include? sht_name
end