Class: Canon::Xml::AttributeHandler
- Inherits:
-
Object
- Object
- Canon::Xml::AttributeHandler
- Defined in:
- lib/canon/xml/attribute_handler.rb
Overview
Attribute handler for C14N 1.1 Handles attribute processing per spec
Instance Method Summary collapse
-
#initialize(encoder) ⇒ AttributeHandler
constructor
A new instance of AttributeHandler.
-
#process_attributes(element, output, omitted_ancestors = []) ⇒ Object
Process attribute axis of an element Includes handling of simple inheritable attributes for document subsets rubocop:disable Metrics/MethodLength.
Constructor Details
#initialize(encoder) ⇒ AttributeHandler
Returns a new instance of AttributeHandler.
8 9 10 |
# File 'lib/canon/xml/attribute_handler.rb', line 8 def initialize(encoder) @encoder = encoder end |
Instance Method Details
#process_attributes(element, output, omitted_ancestors = []) ⇒ Object
Process attribute axis of an element Includes handling of simple inheritable attributes for document subsets rubocop:disable Metrics/MethodLength
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/canon/xml/attribute_handler.rb', line 15 def process_attributes(element, output, omitted_ancestors = []) return unless element.in_node_set? # Collect attributes including inherited simple inheritable ones attributes = collect_attributes(element, omitted_ancestors) # Sort and process attributes attributes.each do |attr| output << " " output << attr.qname output << '="' output << @encoder.encode_attribute(attr.value) output << '"' end end |