diff --git a/lib/nokogiri/xml/document.rb b/lib/nokogiri/xml/document.rb index 71a94ff282..ea18738a99 100644 --- a/lib/nokogiri/xml/document.rb +++ b/lib/nokogiri/xml/document.rb @@ -41,7 +41,7 @@ class Document < Nokogiri::XML::Node # # Nokogiri.XML() is a convenience method which will call this method. # - def self.parse string_or_io, url = nil, encoding = nil, options = ParseOptions::DEFAULT_XML, &block + def self.parse string_or_io, url = nil, encoding = nil, options = ParseOptions::DEFAULT_XML options = Nokogiri::XML::ParseOptions.new(options) if Integer === options # Give the options to the user yield options if block_given? diff --git a/lib/nokogiri/xml/node.rb b/lib/nokogiri/xml/node.rb index ebd3e74a05..3c869f4433 100644 --- a/lib/nokogiri/xml/node.rb +++ b/lib/nokogiri/xml/node.rb @@ -795,7 +795,7 @@ def <=> other # Do xinclude substitution on the subtree below node. If given a block, a # Nokogiri::XML::ParseOptions object initialized from +options+, will be # passed to it, allowing more convenient modification of the parser options. - def do_xinclude options = XML::ParseOptions::DEFAULT_XML, &block + def do_xinclude options = XML::ParseOptions::DEFAULT_XML options = Nokogiri::XML::ParseOptions.new(options) if Integer === options # give options to user diff --git a/lib/nokogiri/xml/node_set.rb b/lib/nokogiri/xml/node_set.rb index 83f5e825f5..e6b95a9f1c 100644 --- a/lib/nokogiri/xml/node_set.rb +++ b/lib/nokogiri/xml/node_set.rb @@ -44,7 +44,7 @@ def empty? ### # Returns the index of the first node in self that is == to +node+ or meets the given block. Returns nil if no match is found. - def index(node = nil, &block) + def index(node = nil) if node warn "given block not used" if block_given? each_with_index { |member, j| return j if member == node } @@ -197,7 +197,7 @@ def remove_attr name ### # Iterate over each node, yielding to +block+ - def each(&block) + def each return to_enum unless block_given? 0.upto(length - 1) do |x| @@ -230,8 +230,8 @@ def inner_html *args end ### - # Wrap this NodeSet with +html+ or the results of the builder in +blk+ - def wrap(html, &blk) + # Wrap this NodeSet with +html+ + def wrap(html) each do |j| new_parent = document.parse(html).first j.add_next_sibling(new_parent)