Module: Aquarium::Utils::ArrayUtils
- Included in:
- Aspects::AfterRaisingAdviceChainNode, Aspects::Aspect, Aspects::DefaultObjectsHandler, Aspects::Pointcut, Finders::MethodFinder, Finders::TypeFinder, HashUtils, OptionsUtils
- Defined in:
- lib/aquarium/utils/array_utils.rb
Class Method Summary collapse
- .make_array(*value_or_enum) ⇒ Object
-
.strip_array_nils(array) ⇒ Object
Return a copy of the input array with all nils removed.
Instance Method Summary collapse
-
#make_array(*value_or_enum) ⇒ Object
Return an array containing the input item or list of items.
-
#strip_array_nils(array) ⇒ Object
Return a copy of the input array with all nils removed.
Class Method Details
.make_array(*value_or_enum) ⇒ Object
15 16 17 |
# 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) ⇒ Object
Return a copy of the input array with all nils removed.
25 26 27 |
# File 'lib/aquarium/utils/array_utils.rb', line 25 def self.strip_array_nils array array.to_a.compact end |
Instance Method Details
#make_array(*value_or_enum) ⇒ Object
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 [].
11 12 13 |
# 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) ⇒ Object
Return a copy of the input array with all nils removed.
20 21 22 |
# File 'lib/aquarium/utils/array_utils.rb', line 20 def strip_array_nils array ArrayUtils.strip_array_nils array end |