- This repository is archived
- No longer maintained
- All versions have been yanked from https://rubygems.org for releasing valuable namespace for others
This gem is needless in the now since Ruby officially supporting keyword_init
Struct will be able to constructed from key-value pairs.
- Pure Ruby :)
require 'struct/for_pairs'
FooBar = Struct.new :foo, :bar
foobar = FooBar.for_pairs bar: 456, foo: 123
foobar.foo #=> 123
foobar.bar #=> 456
foobar = Struct.for_pairs foo: 123, bar: 456
foobar.foo #=> 123
foobar.bar #=> 456
from_pairs
- Ruby 1.9.3 or later
The MIT X11 License
Copyright (c) 2012 Kenichi Kamiya
See MIT-LICENSE for further details.