Skip to content

Instantly share code, notes, and snippets.

Embed
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
end
# in array rb becomes
def self.swap(tuple ,a, b)
temp = tuple.at(a)
tuple[a] = tuple.at(b)
tuple[b] = temp
end
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.