A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.aws.amazon.com/sdkforruby/api/Aws/Resources/Builder.html below:

Builder — AWS SDK for Ruby V2

You are viewing documentation for version 2 of the AWS SDK for Ruby. Version 3 documentation can be found here.

Class: Aws::Resources::Builder
Inherits:
Object show all
Includes:
Options
Defined in:
aws-sdk-resources/lib/aws-sdk-resources/builder.rb
Overview

A Builder construct resource objects. It extracts resource identifiers for the objects it builds from another resource object and/or an AWS response.

Instance Attribute Summary collapse Instance Method Summary collapse Constructor Details #initialize(options = {}) ⇒ Builder

Returns a new instance of Builder.

13
14
15
16
# File 'aws-sdk-resources/lib/aws-sdk-resources/builder.rb', line 13

def initialize(options = {})
  @resource_class = options[:resource_class]
  @sources = options[:sources] || []
end
Instance Attribute Details #resource_class ⇒ Class<Resource>
19
20
21
# File 'aws-sdk-resources/lib/aws-sdk-resources/builder.rb', line 19

def resource_class
  @resource_class
end
#sources ⇒ Array<BuilderSources::Source>

Returns A list of resource identifier sources.

23
24
25
# File 'aws-sdk-resources/lib/aws-sdk-resources/builder.rb', line 23

def sources
  @sources
end
Instance Method Details #build(options = {}) ⇒ Resource+

Returns a resource object or an array of resource objects if #plural?.

35
36
37
38
39
40
41
42
43
44
# File 'aws-sdk-resources/lib/aws-sdk-resources/builder.rb', line 35

def build(options = {})
  identifier_map = @sources.each.with_object({}) do |source, hash|
    hash[source.target] = source.(options)
  end
  if plural?
    build_batch(identifier_map, options)
  else
    build_one(identifier_map, options)
  end
end
#plural? ⇒ Boolean

Returns true if this builder returns an array of resource objects from #build.

27
28
29
# File 'aws-sdk-resources/lib/aws-sdk-resources/builder.rb', line 27

def plural?
  @sources.any?(&:plural?)
end

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4