This is the first release (and actually my first announce on this list
as well) of keyword_arguments[1][2]
What it does is provide a handful of convenient methods for working
with hashes as named arguments. Those methods allow you to specify
required, default and allowed arguments, without the need of
duplicating code all over your methods, without the need of even
adding anything to your actual methods.
There is also an example[3] online, showing all three methods in action.
I know that this gem might be quite controversial because it is
patching core classes, but I tried to take care that I won't actually
break anything, it should even work with other libraries that have
their own "method describing" methods.
If you have any ideas, bugs or criticism, or even if you just
appreciate the idea, answer this thread (or fork and patch it, heh)
Links
[1] http://rubyforge.org/projects/keywordargs/
[2] http://github.com/dominikh/keyword_arguments/tree/master
[3] http://github.com/dominikh/keyword_arguments/blob/7c9574f926ecea514f0a4e153698c57e3b884091/README.markdown
···
--
Dominik Honnef
dominikho@gmx.net
This looks very useful and time-saving, thanks for posting!
Dan
···
On Fri, Jul 24, 2009 at 9:59 PM, <dominikho@gmx.net> wrote:
This is the first release (and actually my first announce on this list
as well) of keyword_arguments[1][2]
What it does is provide a handful of convenient methods for working
with hashes as named arguments. Those methods allow you to specify
required, default and allowed arguments, without the need of
duplicating code all over your methods, without the need of even
adding anything to your actual methods.
There is also an example[3] online, showing all three methods in action.
I know that this gem might be quite controversial because it is
patching core classes, but I tried to take care that I won't actually
break anything, it should even work with other libraries that have
their own "method describing" methods.
If you have any ideas, bugs or criticism, or even if you just
appreciate the idea, answer this thread (or fork and patch it, heh)
Links
[1] http://rubyforge.org/projects/keywordargs/
[2] GitHub - dominikh/keyword_arguments: named_arguments comes with a bunch of convenient methods for making "named arguments" (hashes as method arguments) in Ruby less painfull
[3]
keyword_arguments/README.markdown at 7c9574f926ecea514f0a4e153698c57e3b884091 · dominikh/keyword_arguments · GitHub
--
Dominik Honnef
dominikho@gmx.net
Nice. Also checkout GitHub - maca/arguments: You don't have to wait until Ruby 2.0 to get (named|keyword) arguments. Works with 1.8.6, 1.8.7 and 1.9.1. An alternative to options hash. it's
nice 
=r
···
On Fri, Jul 24, 2009 at 9:59 PM, <domini...@gmx.net> wrote:
> This is the first release (and actually my first announce on this list
> as well) ofkeyword_arguments[1][2]
> What it does is provide a handful of convenient methods for working
> with hashes as named arguments. Those methods allow you to specify
> required, default and allowed arguments, without the need of
> duplicating code all over your methods, without the need of even
> adding anything to your actual methods.