Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
before and after tuple.rb method
# normal usage in array method
@tuple.swap i, random
# becomes
swap(@tuple, i, random)
# normally in tuple.rb
def swap(a, b)
temp = at(a)
self[a] = at(b)
self[b] = temp
# in array rb becomes
def self.swap(tuple ,a, b)
temp =
tuple[a] =
tuple[b] = temp
private :swap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.