class Saxlsx::SharedStringCollectionParser

Public Class Methods

new(&block) click to toggle source
# File lib/saxlsx/shared_string_collection_parser.rb, line 14
def initialize(&block)
  @block = block
end
parse(file_system, &block) click to toggle source
# File lib/saxlsx/shared_string_collection_parser.rb, line 5
def self.parse(file_system, &block)
  shared_strings = file_system.shared_strings
  if shared_strings
    SaxParser.parse self.new(&block), shared_strings
  else
    []
  end
end

Public Instance Methods

end_element(name) click to toggle source
# File lib/saxlsx/shared_string_collection_parser.rb, line 22
def end_element(name)
  if name == :si
    @block.call @current_string
    @current_string = nil
  end
end
start_element(name) click to toggle source
# File lib/saxlsx/shared_string_collection_parser.rb, line 18
def start_element(name)
  @current_string = String.new if name == :si
end
text(value) click to toggle source
# File lib/saxlsx/shared_string_collection_parser.rb, line 29
def text(value)
  @current_string << CGI.unescapeHTML(value) if @current_string
end