module Aquarium::Utils::ArrayUtils

Public Class Methods

make_array(*value_or_enum) click to toggle source
   # File lib/aquarium/utils/array_utils.rb
15 def self.make_array *value_or_enum
16   strip_array_nils do_make_array(value_or_enum)
17 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
25 def self.strip_array_nils array
26   array.to_a.compact
27 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
11 def make_array *value_or_enum
12   ArrayUtils.make_array value_or_enum
13 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
20 def strip_array_nils array
21   ArrayUtils.strip_array_nils array
22 end