lib/reverse_parameters.rb in reverse_parameters-0.1.0 vs lib/reverse_parameters.rb in reverse_parameters-0.2.0

- old
+ new

@@ -1,9 +1,10 @@ require "reverse_parameters/version" class ReverseParameters + # @param input [Proc, Array] def initialize(input) if input.respond_to?(:to_proc) @params = input.to_proc.parameters elsif input.respond_to?(:to_ary) @params = input.to_ary @@ -11,15 +12,17 @@ raise ArgumentError.new("Input must be an Array of parameters or a Proc object.") end end # Method parameters are the names listed in the function definition. + # @return [ReverseParameters::Parameters] def parameters Parameters.new(params) end # Method arguments are the real values passed to (and received by) the function. + # @return [ReverseParameters::Arguments] def arguments Arguments.new(params) end private @@ -75,9 +78,11 @@ case state when :req name when :rest "*#{name}" + when :keyrest + "**#{name}" when :opt "#{name}=nil" when :keyreq "#{name}:" when :key