Class: Nokogiri::XML::Node
- Inherits:
-
Object
- Object
- Nokogiri::XML::Node
- Defined in:
- lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_localize_helper.rb
Instance Method Summary collapse
-
#=~(other) ⇒ Object
Return true if this node is content-equivalent to other, false otherwise.
Instance Method Details
#=~(other) ⇒ Object
Return true if this node is content-equivalent to other, false otherwise
427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_localize_helper.rb', line 427 def =~(other) return true if self == other return false unless name == other.name stype = node_type otype = other.node_type return false unless stype == otype sa = attributes oa = other.attributes return false unless sa.length == oa.length sa = sa.sort.map { |n, a| [n, a.value, a.namespace&.href] } oa = oa.sort.map { |n, a| [n, a.value, a.namespace&.href] } return false unless sa == oa skids = children okids = other.children return false unless skids.length == okids.length return false if stype == TEXT_NODE && (content != other.content) sns = namespace ons = other.namespace return false if !sns ^ !ons return false if sns && (sns.href != ons.href) skids.to_enum.with_index.all? { |ski, i| ski =~ okids[i] } end |