lib/xembly/addif.rb in xembly-0.4.2 vs lib/xembly/addif.rb in xembly-0.4.3

- old
+ new

@@ -1,8 +1,9 @@ -# encoding: utf-8 +# frozen_string_literal: true + # -# Copyright (c) 2016 Yegor Bugayenko +# Copyright (c) 2016-2021 Yegor Bugayenko # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the 'Software'), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell @@ -33,10 +34,10 @@ end def exec(dom, cursor) after = [] cursor.each do |node| - if !node.element_children.any? { |e| e.name == @name } + if node.element_children.none? { |e| e.name == @name } child = Nokogiri::XML::Node.new(@name, dom) node.add_child(child) after.push(child) Xembly.log.info "node \"#{@name}\" added to \"#{node.name}\"" else