Class: Aws::Partitions::PartitionList Private
- Inherits:
-
Object
- Object
- Aws::Partitions::PartitionList
- 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
- .build(partitions) ⇒ Object private
Instance Method Summary collapse
- #add_partition(partition) ⇒ Object private
- #clear ⇒ Object private
- #each(&block) ⇒ Enumerator<Partition> private
-
#initialize ⇒ PartitionList
constructor
private
A new instance of PartitionList.
- #partition(partition_name) ⇒ Partition private
- #partitions ⇒ Array<Partition> private
Constructor Details
#initialize ⇒ PartitionList
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.
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 |
#clear ⇒ 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.
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.
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.
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 |
#partitions ⇒ Array<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.
34 35 36 |
# File 'lib/aws-sdk-core/partitions/partition_list.rb', line 34 def partitions @partitions.values end |