Skip to content
This repository
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 42 lines (27 sloc) 0.775 kb

Hashy

Build Status

Hashy implements three new methods on Hash that have been proposed for inclusion in Ruby 2.1.0:

  • map_pair
  • map_key
  • map_value

Installation

gem install hashy

Usage

require 'hashy'

hash = { aim: true }
#=> {:aim=>true}

hash.map_pair { |k, v| [k.to_s, v.to_s] }
#=> {"aim"=>"true"}

hash.map_key &:to_s
#=> {"aim"=>true}

hash.map_value &:to_s
#=> {:aim=>"true"}

Credits

  • dsisnero's initial post on ruby-core
  • nobu's suggestion of appropriate method names and making a gem
  • heftig's refactoring of the code

Thanks all!

Something went wrong with that request. Please try again.