Sha256: 6a8b91c7b636302921bd9e9b6a92f74c56272071433027e023fac8aeeb04cbf5
Contents?: true
Size: 1.35 KB
Versions: 924
Compression:
Stored size: 1.35 KB
Contents
module Aws module Partitions # @api private class PartitionList include Enumerable def initialize @partitions = {} end def clear @partitions = {} end # @return [Enumerator<Partition>] def each(&block) @partitions.each_value(&block) end # @param [String] partition_name # @return [Partition] 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 # @return [Array<Partition>] def partitions @partitions.values end # @param [Partition] partition def add_partition(partition) if Partition === partition @partitions[partition.name] = partition else raise ArgumentError, "expected Partition, got #{partition.class}" end end class << self # @api private def build(partitions) partitions['partitions'].inject(PartitionList.new) do |list, partition| list.add_partition(Partition.build(partition)) list end end end end end end
Version data entries
924 entries across 924 versions & 2 rubygems