class ChupaText::Decomposers::OpenDocument::AttributesListener
Constants
- DUBLIN_CORE_URI
- META_URI
Public Class Methods
new(attributes)
click to toggle source
# File lib/chupa-text/decomposers/opendocument.rb, line 76 def initialize(attributes) @attributes = attributes @name = nil @type = nil end
Public Instance Methods
cdata(content)
click to toggle source
# File lib/chupa-text/decomposers/opendocument.rb, line 115 def cdata(content) set_attribute(content) end
characters(text)
click to toggle source
# File lib/chupa-text/decomposers/opendocument.rb, line 111 def characters(text) set_attribute(text) end
end_element(uri, local_name, qname)
click to toggle source
# File lib/chupa-text/decomposers/opendocument.rb, line 106 def end_element(uri, local_name, qname) @name = nil @type = nil end
set_attribute(value)
click to toggle source
# File lib/chupa-text/decomposers/opendocument.rb, line 119 def set_attribute(value) return if @name.nil? case @type when :w3cdtf value = Time.xmlschema(value) when :array values = @attributes[@name] || [] values << value value = values end @attributes[@name] = value end
start_element(uri, local_name, qname, attributes)
click to toggle source
# File lib/chupa-text/decomposers/opendocument.rb, line 82 def start_element(uri, local_name, qname, attributes) case uri when META_URI case local_name when "creation-date" @name = "created_time" @type = :w3cdtf when "keyword" @name = "keywords" @type = :array when "generator" @name = local_name end when DUBLIN_CORE_URI case local_name when "date" @name = "modified_time" @type = :w3cdtf when "description", "title", "subject" @name = local_name end end end