reverse_parameters 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0137ecfeb2ebd8f1b36b33d81bf081071729ad77
4
- data.tar.gz: 14a1e5ba91398b76e45600e149c5e33d08d230e2
3
+ metadata.gz: adf1aec736659f20365e3d92f474c03f45031f91
4
+ data.tar.gz: 8e19ca1e68f7f0679ebd2af4718ecba475d3629a
5
5
  SHA512:
6
- metadata.gz: d970197d444268b8863e0717f40c34b23de1d3b9110be953ca4940b902b83d6ebb2aca69404b5b0b983ea184d73627051d20cd92365eb7c685c992f03aa9a96b
7
- data.tar.gz: 1f363ed82c88350f66ff4fa587290a69e9895df7a54de08c22fffa82a6079ad07a8d1142ad2a18bb2cd47298098fc20098d8a4c9b27bccf079ca19c6927e9a88
6
+ metadata.gz: 6a831cba1405aaedded16672f2e7f1dc11a1b58964d0a3731a07a20abe13ad7f7bc41663e4655858269c4cae6572ffb6700dbb62710f65c7e208b05c2bbd95ea
7
+ data.tar.gz: 1bc060fb412311dae8f30545b95118409805d87853e8d68f1cd28eb19dee76cb6b7de975dd5585f9257c78ca9154699394f7b65c4e8798206151074187aaecba
@@ -1,3 +1,11 @@
1
+ ## 1.1.1 - 2016-07-21
2
+
3
+ ## Fix
4
+ - `ReverseParameters::Arguments` has been fixed to correctly make values passable from keyrest and rest args.
5
+
6
+ ### Enhancement
7
+ - `ReverseParameters.new` now correctly accepts `UnboundMethod` objects.
8
+
1
9
  ## 1.1.0 - 2016-03-24
2
10
 
3
11
  ### API Changes
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # ReverseParameters
2
2
 
3
3
  [![Build Status](https://travis-ci.org/zeisler/reverse_parameters.svg)](https://travis-ci.org/zeisler/reverse_parameters)
4
- [![Code Climate](https://codeclimate.com/github/zeisler/active_mocker.png)](https://codeclimate.com/github/zeisler/reverse_parameters)
4
+ [![Code Climate](https://codeclimate.com/github/zeisler/reverse_parameters/badges/gpa.svg)](https://codeclimate.com/github/zeisler/reverse_parameters)
5
5
  [![Gem Version](https://badge.fury.io/rb/reverse_parameters.svg)](http://badge.fury.io/rb/reverse_parameters)
6
6
 
7
7
  Recreate ruby method signatures using ruby's method to Proc creation `#method(:method_name).parameters`. Use this to dynamically recreate method parameter interfaces.
@@ -53,7 +53,7 @@ def example_method(named_param:)
53
53
  end
54
54
 
55
55
  # Method arguments are the real values passed to (and received by) the function.
56
- method(:example_method).reverse_parameters_.arguments.to_s
56
+ method(:example_method).reverse_parameters.arguments.to_s
57
57
  #=> "named_param: named_param"
58
58
 
59
59
  # Method parameters are the names listed in the function definition.
@@ -16,6 +16,8 @@ module ReverseParameters
16
16
  @params = input.to_proc.parameters
17
17
  elsif input.respond_to?(:to_ary)
18
18
  @params = input.to_ary
19
+ elsif input.is_a? UnboundMethod
20
+ @params = input.parameters
19
21
  else
20
22
  raise ArgumentError.new("Input must be an Array of parameters or a Proc object.")
21
23
  end
@@ -64,6 +66,10 @@ module ReverseParameters
64
66
  map(&:to_s)
65
67
  end
66
68
 
69
+ def [](value)
70
+ @collection[value]
71
+ end
72
+
67
73
  class Item
68
74
  def initialize(name:, state:, **options)
69
75
  @name = name
@@ -85,6 +91,10 @@ module ReverseParameters
85
91
  case state
86
92
  when :key, :keyreq
87
93
  "#{name}: #{name}"
94
+ when :keyrest
95
+ "**#{name}"
96
+ when :rest
97
+ "*#{name}"
88
98
  when :block
89
99
  block(name)
90
100
  else
@@ -1,3 +1,3 @@
1
1
  module ReverseParameters
2
- VERSION = "1.1.0".freeze
2
+ VERSION = "1.1.1".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reverse_parameters
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dustin Zeisler
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-03-24 00:00:00.000000000 Z
11
+ date: 2016-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
98
  version: '0'
99
99
  requirements: []
100
100
  rubyforge_project:
101
- rubygems_version: 2.2.5
101
+ rubygems_version: 2.5.1
102
102
  signing_key:
103
103
  specification_version: 4
104
104
  summary: Recreate ruby method signatures.