Class: Unxls::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/unxls/map.rb,
lib/unxls/parser.rb

Overview

Opens the compound file and parses the needed storages and streams (2.1.7)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file, settings) ⇒ Parser

Returns a new instance of Parser.

Parameters:

  • file (File)
  • settings (Hash)


10
11
12
13
# File 'lib/unxls/parser.rb', line 10

def initialize(file, settings)
  @file = file
  @settings = settings
end

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



5
6
7
# File 'lib/unxls/parser.rb', line 5

def file
  @file
end

#settingsObject

Returns the value of attribute settings.



6
7
8
# File 'lib/unxls/parser.rb', line 6

def settings
  @settings
end

Instance Method Details

#parseHash

Returns:

  • (Hash)


16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/unxls/parser.rb', line 16

def parse
  biff_version = detect_biff_version
  result = {}

  case biff_version
  when :BIFF8
    result[:workbook_stream] = Unxls::Biff8::WorkbookStream.new(self).parse
    # parse other storages/streams
  else
    raise "Sorry, #{biff_version} is not supported yet"
  end

  result
end