Method: Array#flipflop!
- Defined in:
- lib/extra_lib/core_ext/array.rb
#flipflop! ⇒ Object
Destructive version of Array#flipflop.
Returns: Array or nil
21 22 23 24 25 26 |
# File 'lib/extra_lib/core_ext/array.rb', line 21 def flipflop! if size > 1 a, b = shift, pop unshift(b); push(a) end end |