README.md in reverse_parameters-0.1.0 vs README.md in reverse_parameters-0.2.0
- old
+ new
@@ -1,9 +1,10 @@
# ReverseParameters
[![Build Status](https://travis-ci.org/zeisler/reverse_parameters.svg)](https://travis-ci.org/zeisler/reverse_parameters)
[![Code Climate](https://codeclimate.com/github/zeisler/active_mocker.png)](https://codeclimate.com/github/zeisler/reverse_parameters)
+[![Gem Version](https://badge.fury.io/rb/reverse_parameters.svg)](http://badge.fury.io/rb/reverse_parameters)
Recreate ruby method signatures using ruby's method to Proc creation `#method(:method_name).parameters`. Use this to dynamically recreate method parameter interfaces.
## Installation
@@ -26,20 +27,21 @@
```ruby
require 'reverse_parameters'
def example_method(named_param:)
end
-
-parameters = method(:example_method).parameters
- #=> [[:keyreq, :named_param]]
# Method arguments are the real values passed to (and received by) the function.
-ReverseParameters.arguments(parameters).to_s
+ReverseParameters.new(method(:example_method)).arguments.to_s
#=> "named_param: named_param"
# Method parameters are the names listed in the function definition.
-ReverseParameters.parameters(parameters).to_s
+ReverseParameters.new(method(:example_method)).parameters.to_s
#=> "named_param:"
+
+# Source Ruby API
+method(:example_method).parameters
+ #=> [[:keyreq, :named_param]]
```
## Limitations
Since it is not possible to get the default values using `Proc#parameters` any optional will default to nil.