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
370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_localize_helper.rb', line 370 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 && a.namespace.href] } oa = oa.sort.map { |n, a| [n, a.value, a.namespace && 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 |