lib/vidibus/core_extensions/array.rb
# Deletes items from self and nested arrays that are equal to obj.
# If any items are found, returns obj. If the item is not found, returns nil.
# If the optional code block is given, returns the result of block if the
# item is not found.
#
# Examples:
#
#   list = ["one", "two", ["one"]]
#   list.delete_rec("one") #=> "one"
#   list #=> ["two", []]
#
Deletes items from self and nested arrays that are equal to obj.
If any items are found, returns obj. If the item is not found, returns nil.
If the optional code block is given, returns the result of block if the
item is not found.




Deletes items from self and nested arrays that are equal to obj . If any items are found returns obj . If the item is not found returns nil . If the optional code block is given returns the result of block if the item is not found .
def delete_rec(obj, &block)
    out = nil
    _self = self
    _self.each do |item|
      _out = nil
      if item.class == Array
        _out = item.delete_rec(obj, &block)
      else
        _out = _self.delete(obj, &block)
      end
      out ||= _out
    end
    self.replace(_self)
    out
  end
def delete_rec ( obj , & block ) out = nil _self = self _self . each do | item | _out = nil if item . class == Array _out = item . delete_rec ( obj , & block ) else _out = _self . delete ( obj , & block ) end out ||= _out end self . replace ( _self ) out end
Deletes items from self and nested arrays that are equal to obj.
Deletes items from self and nested arrays that are equal to obj .
obj
<not_specific>
block
<not_specific>