class Aws::Resources::Operations::HasManyOperation
Attributes
builder[R]
@return [Builder]
limit_key[R]
@return [Symbol, nil]
Public Class Methods
new(options)
click to toggle source
@option options [required, Request] :request @option options [required, Builder] :builder @option options [Symbol] :limit_key
Calls superclass method
Aws::Resources::Operations::ResourceOperation.new
# File lib/aws-sdk-resources/operations.rb, line 97 def initialize(options) @limit_key = options[:limit_key] super end
Public Instance Methods
batches(options, &block)
click to toggle source
@api private @return [Enumerator<Batch>]
# File lib/aws-sdk-resources/operations.rb, line 116 def batches(options, &block) if options[:limit] enum_for(:limited_batches, options[:limit], options, &block) else enum_for(:all_batches, options, &block) end end
call(options)
click to toggle source
@option (see Base#call) @return [Collection]
# File lib/aws-sdk-resources/operations.rb, line 110 def call(options) Collection.new(self, options) end
Private Instance Methods
all_batches(options) { |build(merge(response:response))| ... }
click to toggle source
# File lib/aws-sdk-resources/operations.rb, line 126 def all_batches(options, &block) resp = @request.call(options) if resp.respond_to?(:each) resp.each do |response| yield(@builder.build(options.merge(response:response))) end else yield(@builder.build(options.merge(response:resp))) end end
limited_batches(limit, options) { |batch| ... }
click to toggle source
# File lib/aws-sdk-resources/operations.rb, line 137 def limited_batches(limit, options, &block) remaining = limit all_batches(options) do |batch| if batch.size < remaining yield(batch) remaining -= batch.size else yield(batch.first(remaining)) return end end end