Struct with keyword arguments support
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
.gitignore
CODE_OF_CONDUCT.md
LICENSE.txt
README.md
kwstruct.gemspec

README.md

kwstruct

Just like regular Struct, but uses keyword arguments.

Person = KwStruct.new(:name, :age)
sammy = Person.new(name: 'Sammy', age: 30)

Any non-existent arguments will raise an ArgumentError.

Installation

$ gem install kwstruct

Credits

Thanks @apeiros for ideas.
Thanks @bughit for hitting a bug.