class ViewWorkBook

Attributes

workbook[R]

Public Class Methods

new(*args) click to toggle source
# File lib/viewworkbook.rb, line 41
def initialize(*args)
  init_logger(STDOUT, Logger::INFO)
  @log.debug('args is ' << args.to_s)
  wb = args[0]
  path = File.path(wb) if wb
  @log.debug('workbook file will be ' << (path ? path : 'N I L'))

  if(wb)
    msg = file_check(path, :exist?, :file?, :readable?)
    if(!msg)
      begin
        @workbook = SheetData.workbook(path)
        view_sheet if @workbook
      end
    else
      @log.error(yellow("Cannot open " << path << ": " << msg))
      # raise IOError.new(msg)
      puts red("\n\tPlease name a valid spreadsheet file! Aborting.")
      puts
      exit false
    end
  end
  @log.debug('initialized')
end

Public Instance Methods

method_missing(method, *args) click to toggle source
# File lib/viewworkbook.rb, line 66
def method_missing(method, *args)
  @workbook.send(method.to_sym, *args)
end
sheet(number) click to toggle source
# File lib/viewworkbook.rb, line 70
def sheet(number)
  view_sheet(number)
end

Private Instance Methods

view_sheet(number = 0) click to toggle source
# File lib/viewworkbook.rb, line 75
def view_sheet(number = 0)
  @log.debug('default_sheet is ' << sheets[number]) 
  SheetInterface.new(@workbook, number)
end