Module: Spreadsheet
- Defined in:
- lib/compatibility.rb
Class Method Summary collapse
Class Method Details
.open(io_or_path, mode = "rb+") ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/compatibility.rb', line 8 def open io_or_path, mode="rb+" if File.extname(io_or_path).downcase == '.xlsx' RubyXL::Parser.parse(io_or_path) else if io_or_path.respond_to? :seek Excel::Workbook.open(io_or_path) elsif block_given? File.open(io_or_path, mode) do |fh| yield open(fh) end else open File.open(io_or_path, mode) end end end |