Sha256: b6c6edddafaabf1629ef2ffa6c56957ff6a3e8a75612f119375a27e54de1b4b3
Contents?: true
Size: 854 Bytes
Versions: 3
Compression:
Stored size: 854 Bytes
Contents
module Saxlsx class SheetCollectionParser < Ox::Sax CurrentSheet = Struct.new :index, :name def self.parse(file_system, shared_strings, &block) SaxParser.parse self.new(file_system, shared_strings, &block), file_system.workbook end def initialize(file_system, shared_strings, &block) @file_system = file_system @shared_strings = shared_strings @block = block @index = -1 end def start_element(name) @current_sheet = CurrentSheet.new(@index += 1) if name == :sheet end def end_element(name) if name == :sheet @block.call Sheet.new(@current_sheet.name, @current_sheet.index, @file_system, @shared_strings) @current_sheet = nil end end def attr(name, value) @current_sheet.name = value if @current_sheet && name == :name end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
saxlsx-0.3.0 | lib/saxlsx/sheet_collection_parser.rb |
saxlsx-0.2.0 | lib/saxlsx/sheet_collection_parser.rb |
saxlsx-0.1.0 | lib/saxlsx/sheet_collection_parser.rb |