lib/sucker/response.rb in sucker-2.0.0 vs lib/sucker/response.rb in sucker-2.1.0
- old
+ new
@@ -17,11 +17,11 @@
end
# A shorthand that queries for a specified attribute and yields to a given
# block each matching document.
#
- # response.each('Item') { |item| process_item(item) }
+ # response.each('Item') { |item| puts item }
#
def each(path, &block)
find(path).each { |match| block.call(match) }
end
@@ -38,10 +38,10 @@
def find(attribute)
xml.xpath("//xmlns:#{attribute}").map do |element|
HashBuilder.from_xml(element)
end
end
- alias_method :[], :find
+ alias [] find
# Returns true if the response contains errors.
def has_errors?
errors.count > 0
end