Class: Aws::Partitions::PartitionList Private

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/aws-sdk-core/partitions/partition_list.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePartitionList

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of PartitionList.



8
9
10
# File 'lib/aws-sdk-core/partitions/partition_list.rb', line 8

def initialize
  @partitions = {}
end

Class Method Details

.build(partitions) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



50
51
52
53
54
55
# File 'lib/aws-sdk-core/partitions/partition_list.rb', line 50

def build(partitions)
  partitions['partitions'].inject(PartitionList.new) do |list, partition|
    list.add_partition(Partition.build(partition))
    list
  end
end

Instance Method Details

#add_partition(partition) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:



39
40
41
42
43
44
45
# File 'lib/aws-sdk-core/partitions/partition_list.rb', line 39

def add_partition(partition)
  if Partition === partition
    @partitions[partition.name] = partition
  else
    raise ArgumentError, "expected Partition, got #{partition.class}"
  end
end

#clearObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



12
13
14
# File 'lib/aws-sdk-core/partitions/partition_list.rb', line 12

def clear
  @partitions = {}
end

#each(&block) ⇒ Enumerator<Partition>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:



17
18
19
# File 'lib/aws-sdk-core/partitions/partition_list.rb', line 17

def each(&block)
  @partitions.each_value(&block)
end

#partition(partition_name) ⇒ Partition

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • partition_name (String)

Returns:



23
24
25
26
27
28
29
30
31
# File 'lib/aws-sdk-core/partitions/partition_list.rb', line 23

def partition(partition_name)
  if @partitions.key?(partition_name)
    @partitions[partition_name]
  else
    msg = "invalid partition name #{partition_name.inspect}; valid "
    msg << "partition names include %s" % [@partitions.keys.join(', ')]
    raise ArgumentError, msg
  end
end

#partitionsArray<Partition>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:



34
35
36
# File 'lib/aws-sdk-core/partitions/partition_list.rb', line 34

def partitions
  @partitions.values
end