Topic: Reflection and parameter lists

I'm working on a module that exposes some methods in my applications through reflection.

What Class should I use for params ? My worst case option was a name/value set. This method will be exposed through a webservice, with appropriate data validation and scrubbing of course.

#method_name::
   #  The name of the method to be called
   #params::
   #  An attribute set of parameters for the method
   #return_type::
   #  The type of object expected to be returned by the method
   #Returns::
   #   If the result type of the named method matches the expected type, returns the result of the named method
   #   Error code otherwise
  def call_method_by_name(method_name, params, return_type)
    #verify that the method exists
    begin
      method = self.method(method_name)
    rescue NameError => ne
      return ne.message
    end
       
    #verify that the number of parameters matches
   
   
    #run the method
    # this needs to be VERY robust. errors here should NOT propagate outside this method
    # begin/rescue ~= try/catch
    # save the methods result
    #verify that the return types match
    # likely to be arrays of People, Documents, Events. therefore Arrays need to be inspected
   
  end

Re: Reflection and parameter lists

Ok I googled around. Apparently Ruby will only tell you the names of the parameters and not the names. If you want to know the names of parameters you have to read the source file (as text) and parse them out.