class XML::Smart::Dom::NodeSet
Public Class Methods
Source
# File lib/xml/smart_domnodeset.rb, line 8 def initialize(nodeset) @nodeset = nodeset end
Public Instance Methods
Source
# File lib/xml/smart_domnodeset.rb, line 17 def [](*a); Dom::smart_helper(@nodeset[*a]); end
Source
# File lib/xml/smart_domnodeset.rb, line 16 def at(*a); Dom::smart_helper(@nodeset[*a]); end
Source
# File lib/xml/smart_domnodeset.rb, line 21 def delete_all!; @nodeset.remove; @nodeset.to_a.each { |n| @nodeset.delete(n) }; true end
Source
# File lib/xml/smart_domnodeset.rb, line 31 def delete_at(*a) tmp = @nodeset[*a] case tmp when Nokogiri::XML::NodeSet tmp.each { |node| @nodeset.delete(node.remove) } true when Nokogiri::XML::Node @nodeset.delete(tmp.remove) true else false end end
Source
# File lib/xml/smart_domnodeset.rb, line 45 def delete_if(&block) return self if block.nil? tmp = [] @nodeset.each do |node| if block.call(Dom::smart_helper(node)) tmp << node.remove end end tmp.each { |t| @nodeset.delete(t) } self end
Source
# File lib/xml/smart_domnodeset.rb, line 23 def each(&block) return self if block.nil? @nodeset.each do |node| block.call Dom::smart_helper(node) end self end
Source
# File lib/xml/smart_domnodeset.rb, line 14 def first; Dom::smart_helper(@nodeset.first); end
Source
# File lib/xml/smart_domnodeset.rb, line 15 def last; Dom::smart_helper(@nodeset.last); end