module AwsUtil
Public Class Methods
array_or_nil(arr)
click to toggle source
Public: Static method that returns nil if an array is empty
arr - an array to conver
Returns nil if the array is empty, or the original array otherwise
# File lib/util/AwsUtil.rb, line 27 def self.array_or_nil(arr) if arr.nil? || arr.empty? nil else arr end end
aws_array(arr)
click to toggle source
Public: Static method that converts an array to an object that can be used in the AWS API (with quantity and items)
arr - the array to convert
Returns an object with quantity and items
# File lib/util/AwsUtil.rb, line 8 def self.aws_array(arr) if arr.nil? || arr.empty? { quantity: 0, items: nil } else { quantity: arr.size, items: arr } end end
list_paged_results() { |marker| ... }
click to toggle source
# File lib/util/AwsUtil.rb, line 35 def self.list_paged_results more = true marker = nil all_results = [] while more do (result, more, marker) = yield(marker) all_results += result end all_results end