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:
-
gem 'keyword_hash_builder'
-
require 'keyword_hash_builder'
-
load patch in one of two ways:
-
globally
KeywordHashBuilder.load_globally
-
refinement
# in a class / module definition using KeywordHashBuilder.patch
-
Use this syntax:
a = 1 b = 2 c = String puts `a,b,c` # => { a: 1, b: 2, c: String }