Module: RubyTorrent::ArrayDelete2

Defined in:
lib/rubytorrent/peer.rb

Instance Method Summary collapse

Instance Method Details

#delete2(el) ⇒ Object

just like delete but returns the array element deleted rather than the argument. someone should file an rcr.



39
40
41
42
43
44
45
46
47
48
# File 'lib/rubytorrent/peer.rb', line 39

def delete2(el)
  i = index el
  unless i.nil?
    ret = self[i]
    delete_at i
    ret
  else
    nil
  end
end