Class: Ronin::CLI::Commands::Irb Private

Inherits:
Ronin::CLI::Command show all
Defined in:
lib/ronin/cli/commands/irb.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Starts ronin's interactive Ruby shell.

Usage

ronin irb [options]

Options

-I, --include DIR                Directory to add to $LOAD_PATH
-r, --require PATH               Ruby files to require
-h, --help                       Print help information

Since:

  • 2.0.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(include_dirs: [], require_paths: [], **kwargs) ⇒ Irb

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initializes the Ronin::CLI::Commands::Irb command.

Parameters:

  • include_dirs (Array<String>) (defaults to: [])

    Optional Array of directories to add to $LOAD_PATH.

  • require_paths (Array<String>) (defaults to: [])

    Optional Array of paths to require before starting the Ruby shell.

Since:

  • 2.0.0



81
82
83
84
85
86
# File 'lib/ronin/cli/commands/irb.rb', line 81

def initialize(include_dirs: [], require_paths: [], **kwargs)
  super(**kwargs)

  @include_dirs  = include_dirs
  @require_paths = require_paths
end

Instance Attribute Details

#include_dirsArray<String> (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The additional directories to add to $LOAD_PATH.

Returns:

  • (Array<String>)

Since:

  • 2.0.0



65
66
67
# File 'lib/ronin/cli/commands/irb.rb', line 65

def include_dirs
  @include_dirs
end

#require_pathsArray<String> (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The additional paths to require before starting the Ruby shell.

Returns:

  • (Array<String>)

Since:

  • 2.0.0



70
71
72
# File 'lib/ronin/cli/commands/irb.rb', line 70

def require_paths
  @require_paths
end

Instance Method Details

#run(*argv) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Runs the ronin irb command.

Since:

  • 2.0.0



91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/ronin/cli/commands/irb.rb', line 91

def run(*argv)
  @include_dirs.each do |dir|
    $LOAD_PATH.unshift(dir)
  end

  @require_paths.each do |path|
    require(path)
  end

  require 'ronin'
  RubyShell.start
end