Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/l5m-tools/array.rb

Instance Method Summary collapse

Instance Method Details

#option!(opt) ⇒ Object

This method will return the argument value.

Example

["svn", "--email", "[email protected]"].option!('--email)' => "[email protected]"
And the list will be ["svn"]
get option index --email index, delete --email, then delete value next to --email


8
9
10
11
12
# File 'lib/l5m-tools/array.rb', line 8

def option!(opt)
  if i = self.index(opt)         
    return self.delete_at(i) && self.delete_at(i)
  end
end