Module: ObjectRepository::Reader::XLS

Defined in:
lib/watir-or/readers/xls.rb

Class Method Summary collapse

Class Method Details

.read(file, options = nil, &block) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/watir-or/readers/xls.rb', line 6

def self.read(file, options = nil, &block)
  if options.nil?
    read_worksheet(Spreadsheet.open(file).worksheet(0), &block)
  elsif options[:worksheet].is_a?(String)
    read_worksheet(Spreadsheet.open(file).worksheet(options[:worksheet]), &block)
  elsif options[:worksheet] == :all
    Spreadsheet.open(file).worksheets.each { |worksheet|
      read_worksheet(worksheet, &block)
    }
  end
end