Class: Array

Inherits:
Object show all
Defined in:
lib/magnetic/rubyext.rb

Direct Known Subclasses

Magnetic::Field::Set

Instance Method Summary collapse

Instance Method Details

#delete_first(*argv, &block) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/magnetic/rubyext.rb', line 19

def delete_first *argv, &block
  match = block ? block : lambda{|arg| argv.first == arg}
  at = nil
  each_with_index do |element, index|
    if match[element]
      at = index
      break
    end
  end
  at ? delete_at(at) : nil
end