class Xlsxrb::Ooxml::Reader::ThreadedCommentsListener
SAX2 listener for parsing <ThreadedComments> element in xl/threadedComments/threadedComment{N}.xml.
Attributes
threaded_comments
[R]
untyped
Public Class Methods
() → untyped
Source
# File lib/xlsxrb/ooxml/reader/listeners/feature_listeners.rb, line 1911 def initialize @threaded_comments = [] @current_comment = nil @inside_text = false @text_buffer = +"" end
Public Instance Methods
(untyped text) → untyped
Source
# File lib/xlsxrb/ooxml/reader/listeners/feature_listeners.rb, line 1944 def characters(text) @text_buffer << text if @inside_text end
(untyped _uri, untyped local_name, untyped qname) → untyped
Source
# File lib/xlsxrb/ooxml/reader/listeners/feature_listeners.rb, line 1948 def end_element(_uri, local_name, qname) name = element_name(local_name, qname) case name when "text" if @current_comment && @inside_text @current_comment[:text] = @text_buffer.dup @inside_text = false end when "threadedComment" @threaded_comments << @current_comment if @current_comment @current_comment = nil end end
(untyped _uri, untyped local_name, untyped qname, untyped attributes) → untyped
Source
# File lib/xlsxrb/ooxml/reader/listeners/feature_listeners.rb, line 1918 def start_element(_uri, local_name, qname, attributes) name = element_name(local_name, qname) case name when "threadedComment" timestamp = attributes["dT"] || attributes["dt"] @current_comment = { ref: attributes["ref"], dt: timestamp, created_at: timestamp, person_id: attributes["personId"], author_id: attributes["personId"], id: attributes["id"] } @current_comment[:parent_id] = attributes["parentId"] if attributes["parentId"] if attributes.key?("done") @current_comment[:done] = %w[1 true].include?(attributes["done"]) @current_comment[:resolved] = @current_comment[:done] end when "text" if @current_comment @inside_text = true @text_buffer = +"" end end end