Class: Array

Inherits:
Object show all
Defined in:
lib/coaster/core_ext/array.rb

Instance Method Summary collapse

Instance Method Details

#toggle(value) ⇒ Object



2
3
4
5
6
7
8
9
10
# File 'lib/coaster/core_ext/array.rb', line 2

def toggle(value)
  if include?(value)
    delete(value)
    false
  else
    self << value
    true
  end
end