Skip to content

Instantly share code, notes, and snippets.

@osyo-manga
Created January 17, 2016 08:22
Show Gist options
  • Save osyo-manga/8959db92ce0337dd5349 to your computer and use it in GitHub Desktop.
Save osyo-manga/8959db92ce0337dd5349 to your computer and use it in GitHub Desktop.
require "stitcher"
using Stitcher
class Array
stitcher_require +[Fixnum, Fixnum]
def at *indices
at(indices.shift).at(*indices)
end
end
p [1,2,3].at(1)
p [[1,2,3], [4,5,6], [7,8,9]].at(1, 2)
p [
[[1,2,3],[4,5,6],[7,8,9]],
[[10,11,12],[13,14,15],[16,17,18]],
[[19,20,21],[22,23,24],[25,26,27]]
].at(1, 2, 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment