summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChase <chase.gilliam@gmail.com>2018-02-20 22:46:04 -0500
committerChase <chase.gilliam@gmail.com>2018-02-20 22:46:04 -0500
commita189cbe9bab7db759f5b272be54775d4bebbcd13 (patch)
tree74b37734b9083d561953a39b42286cb788a194f9
parent4a7e19e9daa5c57f8c6c0309310bc941c2138cf0 (diff)
downloadpry-a189cbe9bab7db759f5b272be54775d4bebbcd13.tar.gz
touch up, fix typo, keyreq, var names
-rw-r--r--lib/pry/method.rb19
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/pry/method.rb b/lib/pry/method.rb
index 648934ac..c8eb7dde 100644
--- a/lib/pry/method.rb
+++ b/lib/pry/method.rb
@@ -354,19 +354,20 @@ class Pry
# @return [String] A representation of the method's signature, including its
# name and parameters. Optional and "rest" parameters are marked with `*`
- # and block parameters with `&`. Keyword arguments are shown qith `={}`
+ # and block parameters with `&`. Keyword arguments are shown with `:`
# If the parameter names are unavailable, they're given numbered names instead.
# Paraphrased from `awesome_print` gem.
def signature
if respond_to?(:parameters)
- args = parameters.inject([]) do |arr, (typ, nam)|
- nam ||= (typ == :block ? 'block' : "arg#{arr.size + 1}")
- arr << case typ
- when :req then nam.to_s
- when :opt then "#{nam}=?"
- when :rest then "*#{nam}"
- when :block then "&#{nam}"
- when :key then "#{nam}={}"
+ args = parameters.inject([]) do |args_array, (arg_type, name)|
+ name ||= (arg_type == :block ? 'block' : "arg#{args_array.size + 1}")
+ args_array << case arg_type
+ when :req then name.to_s
+ when :opt then "#{name}=?"
+ when :rest then "*#{name}"
+ when :block then "&#{name}"
+ when :key then "#{name}:?"
+ when :keyreq then "#{name}:"
else '?'
end
end