module Aquarium::Utils::ArrayUtils

Public Class Methods

make_array(*value_or_enum) click to toggle source
# File lib/aquarium/utils/array_utils.rb, line 15
def self.make_array *value_or_enum
  strip_array_nils do_make_array(value_or_enum)
end
strip_array_nils(array) click to toggle source

Return a copy of the input array with all nils removed.

# File lib/aquarium/utils/array_utils.rb, line 25
def self.strip_array_nils array
  array.to_a.compact
end

Public Instance Methods

make_array(*value_or_enum) click to toggle source

Return an array containing the input item or list of items. If the input is an array, it is returned. In all cases, the constructed array is a flattened version of the input and any nil elements are removed by strip_array_nils. Note that this behavior effectively converts nil to [].

# File lib/aquarium/utils/array_utils.rb, line 11
def make_array *value_or_enum
  ArrayUtils.make_array value_or_enum
end
strip_array_nils(array) click to toggle source

Return a copy of the input array with all nils removed.

# File lib/aquarium/utils/array_utils.rb, line 20
def strip_array_nils array
  ArrayUtils.strip_array_nils array
end