Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/ds_hash/array_core_ext.rb
Instance Method Summary collapse
- #clean ⇒ Object (also: #compact)
- #clean! ⇒ Object (also: #compact!)
Instance Method Details
#clean ⇒ Object Also known as: compact
19 20 21 22 |
# File 'lib/ds_hash/array_core_ext.rb', line 19 def clean arr = self.deep_dup arr.clean! end |
#clean! ⇒ Object Also known as: compact!
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/ds_hash/array_core_ext.rb', line 4 def clean! swoop = Proc.new { |v| if v.respond_to? 'clean!' v.clean! v.empty? elsif v.respond_to? 'compact!' v.compact! v.empty? else v.to_s.empty? end } delete_if &swoop end |