lib/action_controller/vendor/html-scanner/html/node.rb in actionpack-3.0.1 vs lib/action_controller/vendor/html-scanner/html/node.rb in actionpack-3.0.2

- old
+ new

@@ -36,22 +36,18 @@ end private def keys_to_strings(hash) - hash.keys.inject({}) do |h,k| - h[k.to_s] = hash[k] - h - end + Hash[hash.keys.map {|k| [k.to_s, hash[k]]}] end def keys_to_symbols(hash) - hash.keys.inject({}) do |h,k| + Hash[hash.keys.map do |k| raise "illegal key #{k.inspect}" unless k.respond_to?(:to_sym) - h[k.to_sym] = hash[k] - h - end + [k.to_sym, hash[k]] + end] end end # The base class of all nodes, textual and otherwise, in an HTML document. class Node #:nodoc: @@ -75,12 +71,10 @@ @line, @position = line, pos end # Return a textual representation of the node. def to_s - s = "" - @children.each { |child| s << child.to_s } - s + @children.join() end # Return false (subclasses must override this to provide specific matching # behavior.) +conditions+ may be of any type. def match(conditions)