Method: Roo::Spreadsheet.open

Defined in:
lib/roo/spreadsheet.rb

.open(path, options = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/roo/spreadsheet.rb', line 6

def open(path, options = {})
  path      = path.respond_to?(:path) ? path.path : path
  extension = extension_for(path, options)

  begin
    Roo::CLASS_FOR_EXTENSION.fetch(extension).new(path, options)
  rescue KeyError
    raise ArgumentError,
          "Can't detect the type of #{path} - please use the :extension option to declare its type."
  end
end