Class: Aliyun::OSS::Iterator::Objects

Inherits:
Base
  • Object
show all
Defined in:
lib/aliyun/oss/iterator.rb

Overview

Objects iterator

Instance Method Summary collapse

Methods inherited from Base

#next, #to_enum

Constructor Details

#initialize(protocol, bucket_name, opts = {}) ⇒ Objects

Returns a new instance of Objects.



59
60
61
62
# File 'lib/aliyun/oss/iterator.rb', line 59

def initialize(protocol, bucket_name, opts = {})
  super(protocol, opts)
  @bucket = bucket_name
end

Instance Method Details

#fetch(more) ⇒ Object



64
65
66
67
68
69
# File 'lib/aliyun/oss/iterator.rb', line 64

def fetch(more)
  @results, cont = @protocol.list_objects(@bucket, more)
  @results = cont[:common_prefixes] + @results if cont[:common_prefixes]
  @more[:marker] = cont[:next_marker]
  @more[:truncated] = cont[:truncated] || false
end