Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/qat/core_ext/object/deep_compact.rb
Overview
class Array
Instance Method Summary collapse
-
#deep_compact ⇒ Array
Returns a copy of the the current array with non nil values throughout all tree.
-
#deep_compact! ⇒ Array
Replaces the current array with non nil values throughout all tree.
Instance Method Details
#deep_compact ⇒ Array
Returns a copy of the the current array with non nil values throughout all tree
105 106 107 |
# File 'lib/qat/core_ext/object/deep_compact.rb', line 105 def deep_compact deep_dup.deep_compact! end |
#deep_compact! ⇒ Array
Replaces the current array with non nil values throughout all tree
138 139 140 141 142 143 |
# File 'lib/qat/core_ext/object/deep_compact.rb', line 138 def deep_compact! self.compact! self.map! do |element| element.respond_to?(:deep_compact!) ? element.deep_compact! : element end end |