Class: Canon::Comparison::Dimensions::AttributeOrderDimension
- Inherits:
-
BaseDimension
- Object
- BaseDimension
- Canon::Comparison::Dimensions::AttributeOrderDimension
- Defined in:
- lib/canon/comparison/dimensions/attribute_order_dimension.rb
Overview
Attribute order dimension
Handles comparison of attribute ordering. Supports :strict and :ignore behaviors.
Behaviors:
-
:strict - Attributes must appear in the same order
-
:ignore - Attribute order doesn’t matter
Constant Summary
Constants inherited from BaseDimension
BaseDimension::IGNORE, BaseDimension::NORMALIZE, BaseDimension::STRICT
Instance Method Summary collapse
-
#compare_strict(order1, order2) ⇒ Boolean
Strict attribute order comparison.
-
#extract_data(node) ⇒ Array<Symbol>
Extract attribute order from a node.
Methods inherited from BaseDimension
#compare, #compare_normalize, #dimension_name, #equivalent?, #supports_normalization?
Instance Method Details
#compare_strict(order1, order2) ⇒ Boolean
Strict attribute order comparison
40 41 42 |
# File 'lib/canon/comparison/dimensions/attribute_order_dimension.rb', line 40 def compare_strict(order1, order2) # rubocop:disable Naming/PredicateMethod order1 == order2 end |
#extract_data(node) ⇒ Array<Symbol>
Extract attribute order from a node
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/canon/comparison/dimensions/attribute_order_dimension.rb', line 21 def extract_data(node) return [] unless node # Handle Moxml nodes if node.is_a?(Moxml::Node) extract_from_moxml(node) # Handle Nokogiri nodes elsif node.is_a?(Nokogiri::XML::Node) extract_from_nokogiri(node) else [] end end |