1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

Use new :as => :count functionality from Slop

[requires Slop 2.2.0]
This commit is contained in:
Conrad Irwin 2011-12-03 23:29:26 -08:00
parent 4098233435
commit 1b29adb061

View file

@ -39,7 +39,7 @@ class Pry
@method_target = target @method_target = target
opt.on :M, "instance-methods", "Operate on instance methods." opt.on :M, "instance-methods", "Operate on instance methods."
opt.on :m, :methods, "Operate on methods." opt.on :m, :methods, "Operate on methods."
opt.on :s, :super, "Select the 'super' method. Can be repeated to traverse the ancestors." opt.on :s, :super, "Select the 'super' method. Can be repeated to traverse the ancestors.", :as => :count
opt.on :c, :context, "Select object context to run under.", true do |context| opt.on :c, :context, "Select object context to run under.", true do |context|
@method_target = Pry.binding_for(target.eval(context)) @method_target = Pry.binding_for(target.eval(context))
end end
@ -48,9 +48,6 @@ class Pry
# Add the derived :method_object option to a used Slop instance. # Add the derived :method_object option to a used Slop instance.
def process_method_object_options(args, opts) def process_method_object_options(args, opts)
opts[:instance] = opts['instance-methods'] if opts.present?(:methods) opts[:instance] = opts['instance-methods'] if opts.present?(:methods)
# TODO: de-hack when we upgrade Slop: https://github.com/injekt/slop/pull/30
opts.options[:super].force_argument_value opts.options[:super].count if opts.present?(:super)
get_method_or_raise(args.empty? ? nil : args.join(" "), @method_target, opts.to_hash(true)) get_method_or_raise(args.empty? ? nil : args.join(" "), @method_target, opts.to_hash(true))
end end
end end