Sha256: ede9d92b7c9ea72aabe057c697decc64815333d635a4a408e3078d51375310ef

Contents?: true

Size: 1.25 KB

Versions: 6837

Compression:

Stored size: 1.25 KB

Contents

# frozen_string_literal: true

class Pry
  # N.B. using a regular expresion here so that "raise-up 'foo'" does the right thing.
  class Command
    class RaiseUp < Pry::ClassCommand
      match(/raise-up(!?\b.*)/)
      group 'Context'
      description 'Raise an exception out of the current pry instance.'
      command_options listing: 'raise-up'

      banner <<-BANNER
        Raise up, like exit, allows you to quit pry. Instead of returning a value
        however, it raises an exception. If you don't provide the exception to be
        raised, it will use the most recent exception (in pry `_ex_`).

        When called as raise-up! (with an exclamation mark), this command raises the
        exception through any nested prys you have created by "cd"ing into objects.

        raise-up "get-me-out-of-here"

        # This is equivalent to the command above.
        raise "get-me-out-of-here"
        raise-up
      BANNER

      def process
        return _pry.pager.page help if captures[0] =~ /(-h|--help)\b/

        # Handle 'raise-up', 'raise-up "foo"', 'raise-up RuntimeError, 'farble'
        # in a rubyesque manner
        target.eval("pry_instance.raise_up#{captures[0]}")
      end
    end

    Pry::Commands.add_command(Pry::Command::RaiseUp)
  end
end

Version data entries

6,837 entries across 6,832 versions & 33 rubygems

Version Path
ory-kratos-client-0.7.5.alpha2 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/commands/raise_up.rb
mx-platform-ruby-0.4.0 vendor/bundle/ruby/2.6.0/gems/pry-0.13.1/lib/pry/commands/raise_up.rb
mx-platform-ruby-0.3.2 vendor/bundle/ruby/2.6.0/gems/pry-0.13.1/lib/pry/commands/raise_up.rb
mx-platform-ruby-0.3.1 vendor/bundle/ruby/2.6.0/gems/pry-0.13.1/lib/pry/commands/raise_up.rb
rails_mini_profiler-0.2.0 vendor/bundle/ruby/3.0.0/gems/pry-0.14.1/lib/pry/commands/raise_up.rb
passbase-1.3.0 vendor/bundle/ruby/2.7.0/gems/pry-0.13.1/lib/pry/commands/raise_up.rb
pry-0.14.1-java lib/pry/commands/raise_up.rb
pry-0.14.1 lib/pry/commands/raise_up.rb
mfk_openapi_ruby_client-1.0.0 vendor/bundle/ruby/2.7.0/gems/pry-0.13.1/lib/pry/commands/raise_up.rb
pry-0.14.0-java lib/pry/commands/raise_up.rb
pry-0.14.0 lib/pry/commands/raise_up.rb
qiita_org-0.1.35 gems/ruby/2.7.0/gems/pry-0.13.1/lib/pry/commands/raise_up.rb
qiita_org-0.1.34 gems/ruby/2.7.0/gems/pry-0.13.1/lib/pry/commands/raise_up.rb
qiita_org-0.1.33 gems/ruby/2.7.0/gems/pry-0.13.1/lib/pry/commands/raise_up.rb
qiita_org-0.1.32 gems/ruby/2.7.0/gems/pry-0.13.1/lib/pry/commands/raise_up.rb
qiita_org-0.1.31 gems/ruby/2.7.0/gems/pry-0.13.1/lib/pry/commands/raise_up.rb
qiita_org-0.1.30 gems/ruby/2.7.0/gems/pry-0.13.1/lib/pry/commands/raise_up.rb
qiita_org-0.1.29 gems/ruby/2.7.0/gems/pry-0.13.1/lib/pry/commands/raise_up.rb
passbase-1.2.0 vendor/bundle/ruby/2.7.0/gems/pry-0.13.1/lib/pry/commands/raise_up.rb
qiita_org-0.1.28 gems/ruby/2.7.0/gems/pry-0.13.1/lib/pry/commands/raise_up.rb