Project

split_off

0.0
No commit activity in last 3 years
No release in over 3 years
A method to split off a part a hash
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

 Project Readme

#Split Off Ruby Hashes A little complemtent to ActiveSupport's slice. With this method you can quickly create a subhash and pass it to a method as an argument. Your original hash will contain only those keys/values that you have not split off.

Installation

gem install 'split_off'

Usage

require 'split_off'

hash = {one: 1, two: 2, three: 3, zero: nil}
hash.split_off!(:one, :two, :zero) # => {:one=>1, :two=>2}
hash # => {:three => 3}

Enjoy!