Skip to content

Instantly share code, notes, and snippets.

@hedgerh
Last active March 2, 2016 12:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hedgerh/0d7f31b6686c417d58b0 to your computer and use it in GitHub Desktop.
Save hedgerh/0d7f31b6686c417d58b0 to your computer and use it in GitHub Desktop.
foo = [{ order: 1 }, { order: 2 }, { order: 3 }, { order: 4 }]
# First Attempt
nextPage = foo.select{ |f| f.order == current.order+1 } || foo.select{ |f| f.order == 1 }
# Second Attempt
nextPage = foo.select{ |f| f.order == current.order+1 || f.order == 1 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment