Class: Array
Instance Method Summary collapse
Instance Method Details
#swap_indexes(a, b) ⇒ Object
57 58 59 60 61 |
# File 'lib/core_extensions.rb', line 57 def swap_indexes(a,b) temp = self.dup temp[a], temp[b] = temp[b], temp[a] temp end |
#swap_indexes!(a, b) ⇒ Object
63 64 65 66 |
# File 'lib/core_extensions.rb', line 63 def swap_indexes!(a,b) self[a], self[b] = self[b], self[a] self end |
#uniq? ⇒ Boolean
49 50 51 |
# File 'lib/core_extensions.rb', line 49 def uniq? length == uniq.length end |