No commit activity in last 3 years
No release in over 3 years
a shorthand for building hashes, in the manner of javascript
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

gem skeleton generated with gemmy

This provides a syntax somewhat similar to Javascript's shorthand for constructing hashes.

This code is copied from a stack overflow answer authored by user akuhn:

http://stackoverflow.com/a/41456114/2981429


Usage:

  1. gem 'keyword_hash_builder'

  2. require 'keyword_hash_builder'

  3. load patch in one of two ways:

  4. globally

       KeywordHashBuilder.load_globally
    
  5. refinement

      # in a class / module definition
      using KeywordHashBuilder.patch
    
  6. Use this syntax:

     a = 1
     b = 2
     c = String
     puts `a,b,c`
     # => { a: 1, b: 2, c: String }