# File lib/aws/sqs/queue.rb, line 192 def receive_message(opts = {}, &block) resp = client.receive_message(receive_opts(opts)) failed = verify_receive_message_checksum resp raise Errors::ChecksumError.new(failed) unless failed.empty? messages = resp[:messages].map do |m| ReceivedMessage.new(self, m[:message_id], m[:receipt_handle], :body => m[:body], :md5 => m[:md5_of_body], :attributes => m[:attributes]) end if block call_message_block(messages, block) elsif opts[:limit] && opts[:limit] != 1 messages else messages.first end end