Sha256: 8fa415b7d68e56b8518460da3e71af0e727a6aa99b38d3d7259730bd4b9cada6

Contents?: true

Size: 1.07 KB

Versions: 15

Compression:

Stored size: 1.07 KB

Contents

class Pry
  module Helpers
    module OptionsHelpers
      module_function

      # Add method options to the Pry::Slop instance
      def method_options(opt)
        @method_target = target
        opt.on :M, "instance-methods", "Operate on instance methods."
        opt.on :m, :methods, "Operate on methods."
        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.", argument: true do |context|
          @method_target = Pry.binding_for(target.eval(context))
        end
      end

      # Get the method object parsed by the slop instance
      def method_object
        @method_object ||= get_method_or_raise(args.empty? ? nil : args.join(" "), @method_target,
                            super: opts[:super],
                            instance: opts.present?(:'instance-methods') && !opts.present?(:'methods'),
                            methods: opts.present?(:'methods') && !opts.present?(:'instance-methods')
                           )
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 7 rubygems

Version Path
argon-1.3.1 vendor/bundle/ruby/2.7.0/gems/pry-0.12.2/lib/pry/helpers/options_helpers.rb
symbolic_enum-1.1.5 vendor/bundle/ruby/2.7.0/gems/pry-0.12.2/lib/pry/helpers/options_helpers.rb
honeybadger-4.5.3 vendor/bundle/ruby/2.6.0/gems/pry-0.12.2/lib/pry/helpers/options_helpers.rb
chatops-rpc-0.0.2 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/pry-0.12.2/lib/pry/helpers/options_helpers.rb
chatops-rpc-0.0.1 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/pry-0.12.2/lib/pry/helpers/options_helpers.rb
chess_engine-0.0.2 vendor/bundle/gems/pry-0.12.2/lib/pry/helpers/options_helpers.rb
chess_engine-0.0.1 vendor/bundle/gems/pry-0.12.2/lib/pry/helpers/options_helpers.rb
alimentos-alu0100945645-0.1.0 vendor/bundle/ruby/2.3.0/gems/pry-0.12.2/lib/pry/helpers/options_helpers.rb
alimentos-alu0100945645-1.0.0 vendor/bundle/ruby/2.3.0/gems/pry-0.12.2/lib/pry/helpers/options_helpers.rb
pry-0.12.2-java lib/pry/helpers/options_helpers.rb
pry-0.12.2 lib/pry/helpers/options_helpers.rb
pry-0.12.1 lib/pry/helpers/options_helpers.rb
pry-0.12.1-java lib/pry/helpers/options_helpers.rb
pry-0.12.0 lib/pry/helpers/options_helpers.rb
pry-0.12.0-java lib/pry/helpers/options_helpers.rb