Skip to content

Instantly share code, notes, and snippets.

@jbranchaud
Created August 13, 2015 21:45
Show Gist options
  • Save jbranchaud/691f8963c913906f6d89 to your computer and use it in GitHub Desktop.
Save jbranchaud/691f8963c913906f6d89 to your computer and use it in GitHub Desktop.
slice and slice! in Rails
> {a: 1, b: 2, c: 3}.slice(:a)
=> {:a=>1}
> {a: 1, b: 2, c: 3}.slice!(:a)
=> {:b=>2, :c=>3}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment