(named|keyword) arguments gem

Hi I’ve made a gem for supporting keyword arguments in Ruby 1.8.6 and
1.9.1. I think is a good alternative to traditional options hash, usage
is as follows:

require ‘arguments’

class Example
def meth(a = :a, b = :b, c = :c)
[a,b,c]
end

class << self
    def class_method(a = :a, b = :b, c = :c)
        [a,b,c]
    end

    def other_class_method(a = :a, b = :b, c = :c)
        [a,b,c]
    end
    named_args_for :class_method
end

named_args_for :meth, :'self.other_class_method'

end

nu = Example.new
nu.meth #=> [:a,:b,:c]
nu.meth(1, :c => Class) #=> [1,:b,Class]
nu.meth(:b => nil, :a => ‘something’) #=> [‘something’, nil, :c]

Example.class_method(:b => nil, :a => ‘something’) #=> [‘something’,
nil, :c]
Example.other_class_method(:b => nil, :a => ‘something’) #=>
[‘something’, nil, :c]

Hosted at: 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.

Macario