This is more of a Ruby question than an AWS question. It is about use of
“includes” of the Enumerable mix-in.
I am using the Amazon AWS Ruby (v1) SDK. I want to treat an S3
InstanceCollection as an Enumerable so I can use the ‘length’ and ‘at’
methods on it. According to the docs , InstanceCollection inherits
from Collection, which “includes” Enumerable. I’m not sure what that
means exactly, but I get a NoMethodError if I try to use length directly
on an InstanceCollection (see example below). Am I doing something
wrong, or does this sound like a bug in the API (or API docs)?
For the moment I am using the ‘each’ operation to iteratively create a
new Enumerable from the objects in the Collection, but that seems
inefficient and kind of silly.
Is there a way to more directly treat an InstanceCollection as an
Here’s a sample of my problem:
NoMethodError: undefined method
length' for <AWS::S3::ObjectCollection>:AWS::S3::ObjectCollection from (irb):20 from /usr/bin/irb:12:in’
 API docs are at