summaryrefslogtreecommitdiff
path: root/lib/pry
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pry')
-rw-r--r--lib/pry/cli.rb12
-rw-r--r--lib/pry/code.rb2
-rw-r--r--lib/pry/code_object.rb2
-rw-r--r--lib/pry/command.rb16
-rw-r--r--lib/pry/command_set.rb10
-rw-r--r--lib/pry/commands/amend_line.rb2
-rw-r--r--lib/pry/commands/bang.rb2
-rw-r--r--lib/pry/commands/cat.rb10
-rw-r--r--lib/pry/commands/code_collector.rb10
-rw-r--r--lib/pry/commands/easter_eggs.rb2
-rw-r--r--lib/pry/commands/edit.rb6
-rw-r--r--lib/pry/commands/exit.rb2
-rw-r--r--lib/pry/commands/find_method.rb2
-rw-r--r--lib/pry/commands/gem_cd.rb2
-rw-r--r--lib/pry/commands/gem_install.rb2
-rw-r--r--lib/pry/commands/gem_open.rb2
-rw-r--r--lib/pry/commands/gist.rb8
-rw-r--r--lib/pry/commands/hist.rb14
-rw-r--r--lib/pry/commands/ls.rb50
-rw-r--r--lib/pry/commands/play.rb2
-rw-r--r--lib/pry/commands/raise_up.rb2
-rw-r--r--lib/pry/commands/ri.rb2
-rw-r--r--lib/pry/commands/shell_command.rb4
-rw-r--r--lib/pry/commands/show_doc.rb2
-rw-r--r--lib/pry/commands/show_info.rb18
-rw-r--r--lib/pry/commands/stat.rb2
-rw-r--r--lib/pry/commands/watch_expression.rb4
-rw-r--r--lib/pry/commands/wtf.rb2
-rw-r--r--lib/pry/helpers/options_helpers.rb10
-rw-r--r--lib/pry/helpers/table.rb6
-rw-r--r--lib/pry/method.rb6
-rw-r--r--lib/pry/pry_class.rb10
-rw-r--r--lib/pry/pry_instance.rb42
-rw-r--r--lib/pry/repl_file_loader.rb2
-rw-r--r--lib/pry/rubygem.rb2
-rw-r--r--lib/pry/slop.rb20
-rw-r--r--lib/pry/slop/option.rb36
-rw-r--r--lib/pry/testable/mockable.rb2
-rw-r--r--lib/pry/testable/pry_tester.rb2
39 files changed, 166 insertions, 166 deletions
diff --git a/lib/pry/cli.rb b/lib/pry/cli.rb
index d5e34d2d..94773e00 100644
--- a/lib/pry/cli.rb
+++ b/lib/pry/cli.rb
@@ -70,9 +70,9 @@ class Pry
begin
opts = Pry::Slop.parse!(
args,
- :help => true,
- :multiple_switches => false,
- :strict => true,
+ help: true,
+ multiple_switches: false,
+ strict: true,
&options
)
rescue Pry::Slop::InvalidOptionError
@@ -113,7 +113,7 @@ class Pry
end
# Start the session (running any code passed with -e, if there is any)
- Pry.start(context, :input => StringIO.new(Pry.config.exec_string))
+ Pry.start(context, input: StringIO.new(Pry.config.exec_string))
end
end
@@ -198,7 +198,7 @@ Copyright (c) 2016 John Mair (banisterfiend)
Pry.config.requires << file
end
- on :I=, "Add a path to the $LOAD_PATH", :as => Array, :delimiter => ":" do |load_path|
+ on :I=, "Add a path to the $LOAD_PATH", as: Array, delimiter: ":" do |load_path|
load_path.map! do |path|
/\A\.\// =~ path ? path : File.expand_path(path)
end
@@ -220,6 +220,6 @@ Copyright (c) 2016 John Mair (banisterfiend)
on(:c, :context=,
"Start the session in the specified context. Equivalent to `context.pry` in a session.",
- :default => "Pry.toplevel_binding"
+ default: "Pry.toplevel_binding"
)
end
diff --git a/lib/pry/code.rb b/lib/pry/code.rb
index fd49f93f..a5da2de4 100644
--- a/lib/pry/code.rb
+++ b/lib/pry/code.rb
@@ -291,7 +291,7 @@ class Pry
# @param [Integer] line_number (1-based)
# @return [String] the code.
def expression_at(line_number, consume = 0)
- self.class.expression_at(raw, line_number, :consume => consume)
+ self.class.expression_at(raw, line_number, consume: consume)
end
# Get the (approximate) Module.nesting at the give line number.
diff --git a/lib/pry/code_object.rb b/lib/pry/code_object.rb
index 8986d324..c5cca545 100644
--- a/lib/pry/code_object.rb
+++ b/lib/pry/code_object.rb
@@ -79,7 +79,7 @@ class Pry
def initialize(str, _pry_, options={})
options = {
- :super => 0,
+ super: 0,
}.merge!(options)
@str = str
diff --git a/lib/pry/command.rb b/lib/pry/command.rb
index afb55c89..9f23b129 100644
--- a/lib/pry/command.rb
+++ b/lib/pry/command.rb
@@ -84,14 +84,14 @@ class Pry
def default_options(match)
{
- :requires_gem => [],
- :keep_retval => false,
- :argument_required => false,
- :interpolate => true,
- :shellwords => true,
- :listing => (String === match ? match : match.inspect),
- :use_prefix => true,
- :takes_block => false
+ requires_gem: [],
+ keep_retval: false,
+ argument_required: false,
+ interpolate: true,
+ shellwords: true,
+ listing: (String === match ? match : match.inspect),
+ use_prefix: true,
+ takes_block: false
}
end
end
diff --git a/lib/pry/command_set.rb b/lib/pry/command_set.rb
index 73008058..ba08df59 100644
--- a/lib/pry/command_set.rb
+++ b/lib/pry/command_set.rb
@@ -214,8 +214,8 @@ class Pry
original_options = cmd.options.dup
options = original_options.merge!({
- :desc => "Alias for `#{action}`",
- :listing => match
+ desc: "Alias for `#{action}`",
+ listing: match
}).merge!(options)
# ensure default description is used if desc is nil
@@ -249,8 +249,8 @@ class Pry
cmd = find_command_by_match_or_listing(search)
options = {
- :listing => new_match,
- :description => cmd.description
+ listing: new_match,
+ description: cmd.description
}.merge!(options)
@commands[new_match] = cmd.dup
@@ -396,7 +396,7 @@ class Pry
# @return [CommandSet::Result]
def process_line(val, context={})
if command = find_command(val)
- context = context.merge(:command_set => self)
+ context = context.merge(command_set: self)
retval = command.new(context).process_line(val)
Result.new(true, retval)
else
diff --git a/lib/pry/commands/amend_line.rb b/lib/pry/commands/amend_line.rb
index d30c9a0f..cbce677c 100644
--- a/lib/pry/commands/amend_line.rb
+++ b/lib/pry/commands/amend_line.rb
@@ -3,7 +3,7 @@ class Pry
match(/amend-line(?: (-?\d+)(?:\.\.(-?\d+))?)?/)
group 'Editing'
description 'Amend a line of input in multi-line mode.'
- command_options :interpolate => false, :listing => 'amend-line'
+ command_options interpolate: false, listing: 'amend-line'
banner <<-'BANNER'
Amend a line of input in multi-line mode. `amend-line N`, where the N represents
diff --git a/lib/pry/commands/bang.rb b/lib/pry/commands/bang.rb
index 8843458f..7dc6984a 100644
--- a/lib/pry/commands/bang.rb
+++ b/lib/pry/commands/bang.rb
@@ -3,7 +3,7 @@ class Pry
match(/^\s*!\s*$/)
group 'Editing'
description 'Clear the input buffer.'
- command_options :use_prefix => false
+ command_options use_prefix: false
banner <<-'BANNER'
Clear the input buffer. Useful if the parsing process goes wrong and you get
diff --git a/lib/pry/commands/cat.rb b/lib/pry/commands/cat.rb
index 9d568096..f33b31eb 100644
--- a/lib/pry/commands/cat.rb
+++ b/lib/pry/commands/cat.rb
@@ -23,12 +23,12 @@ class Pry
BANNER
def options(opt)
- opt.on :ex, "Show the context of the last exception", :optional_argument => true, :as => Integer
- opt.on :i, :in, "Show one or more entries from Pry's expression history", :optional_argument => true, :as => Range, :default => -5..-1
- opt.on :s, :start, "Starting line (defaults to the first line)", :optional_argument => true, :as => Integer
- opt.on :e, :end, "Ending line (defaults to the last line)", :optional_argument => true, :as => Integer
+ opt.on :ex, "Show the context of the last exception", optional_argument: true, as: Integer
+ opt.on :i, :in, "Show one or more entries from Pry's expression history", optional_argument: true, as: Range, default: -5..-1
+ opt.on :s, :start, "Starting line (defaults to the first line)", optional_argument: true, as: Integer
+ opt.on :e, :end, "Ending line (defaults to the last line)", optional_argument: true, as: Integer
opt.on :l, :'line-numbers', "Show line numbers"
- opt.on :t, :type, "The file type for syntax highlighting (e.g., 'ruby' or 'python')", :argument => true, :as => Symbol
+ opt.on :t, :type, "The file type for syntax highlighting (e.g., 'ruby' or 'python')", argument: true, as: Symbol
end
def process
diff --git a/lib/pry/commands/code_collector.rb b/lib/pry/commands/code_collector.rb
index db7c7022..2604f193 100644
--- a/lib/pry/commands/code_collector.rb
+++ b/lib/pry/commands/code_collector.rb
@@ -29,17 +29,17 @@ class Pry
@output_result_ranges = []
opt.on :l, :lines, "Restrict to a subset of lines. Takes a line number or range",
- :optional_argument => true, :as => Range, :default => 1..-1
+ optional_argument: true, as: Range, default: 1..-1
opt.on :o, :out, "Select lines from Pry's output result history. Takes an index or range",
- :optional_argument => true, :as => Range, :default => -5..-1 do |r|
+ optional_argument: true, as: Range, default: -5..-1 do |r|
output_result_ranges << (r || (-5..-1))
end
opt.on :i, :in, "Select lines from Pry's input expression history. Takes an index or range",
- :optional_argument => true, :as => Range, :default => -5..-1 do |r|
+ optional_argument: true, as: Range, default: -5..-1 do |r|
input_expression_ranges << (r || (-5..-1))
end
opt.on :s, :super, "Select the 'super' method. Can be repeated to traverse the ancestors",
- :as => :count
+ as: :count
opt.on :d, :doc, "Select lines from the code object's documentation"
end
@@ -74,7 +74,7 @@ class Pry
#
# @return [Pry::WrappedModule, Pry::Method, Pry::Command]
def code_object
- Pry::CodeObject.lookup(obj_name, _pry_, :super => opts[:super])
+ Pry::CodeObject.lookup(obj_name, _pry_, super: opts[:super])
end
# Given a string and a range, return the `range` lines of that
diff --git a/lib/pry/commands/easter_eggs.rb b/lib/pry/commands/easter_eggs.rb
index 9d35f2f2..ed863b7a 100644
--- a/lib/pry/commands/easter_eggs.rb
+++ b/lib/pry/commands/easter_eggs.rb
@@ -1,6 +1,6 @@
class Pry
Pry::Commands.instance_eval do
- command "nyan-cat", "", :requires_gem => ["nyancat"] do
+ command "nyan-cat", "", requires_gem: ["nyancat"] do
run ".nyancat"
end
diff --git a/lib/pry/commands/edit.rb b/lib/pry/commands/edit.rb
index b9f0ae59..65b61ee3 100644
--- a/lib/pry/commands/edit.rb
+++ b/lib/pry/commands/edit.rb
@@ -24,12 +24,12 @@ class Pry
def options(opt)
opt.on :e, :ex, "Open the file that raised the most recent exception (_ex_.file)",
- :optional_argument => true, :as => Integer
+ optional_argument: true, as: Integer
opt.on :i, :in, "Open a temporary file containing the Nth input expression. N may be a range",
- :optional_argument => true, :as => Range, :default => -1..-1
+ optional_argument: true, as: Range, default: -1..-1
opt.on :t, :temp, "Open an empty temporary file"
opt.on :l, :line, "Jump to this line in the opened file",
- :argument => true, :as => Integer
+ argument: true, as: Integer
opt.on :n, :"no-reload", "Don't automatically reload the edited file"
opt.on :c, :current, "Open the current __FILE__ and at __LINE__ (as returned by `whereami`)"
opt.on :r, :reload, "Reload the edited code immediately (default for ruby files)"
diff --git a/lib/pry/commands/exit.rb b/lib/pry/commands/exit.rb
index 32c0c2ee..c9a8c527 100644
--- a/lib/pry/commands/exit.rb
+++ b/lib/pry/commands/exit.rb
@@ -3,7 +3,7 @@ class Pry
match 'exit'
group 'Navigating Pry'
description 'Pop the previous binding.'
- command_options :keep_retval => true
+ command_options keep_retval: true
banner <<-'BANNER'
Usage: exit [OPTIONS] [--help]
diff --git a/lib/pry/commands/find_method.rb b/lib/pry/commands/find_method.rb
index 81de21cb..498ad892 100644
--- a/lib/pry/commands/find_method.rb
+++ b/lib/pry/commands/find_method.rb
@@ -5,7 +5,7 @@ class Pry
match 'find-method'
group 'Context'
description 'Recursively search for a method within a Class/Module or the current namespace.'
- command_options :shellwords => false
+ command_options shellwords: false
banner <<-'BANNER'
Usage: find-method [-n|-c] METHOD [NAMESPACE]
diff --git a/lib/pry/commands/gem_cd.rb b/lib/pry/commands/gem_cd.rb
index da1907a6..fb4d9f1e 100644
--- a/lib/pry/commands/gem_cd.rb
+++ b/lib/pry/commands/gem_cd.rb
@@ -3,7 +3,7 @@ class Pry
match 'gem-cd'
group 'Gems'
description "Change working directory to specified gem's directory."
- command_options :argument_required => true
+ command_options argument_required: true
banner <<-'BANNER'
Usage: gem-cd GEM_NAME
diff --git a/lib/pry/commands/gem_install.rb b/lib/pry/commands/gem_install.rb
index 0df27715..a1414b7e 100644
--- a/lib/pry/commands/gem_install.rb
+++ b/lib/pry/commands/gem_install.rb
@@ -3,7 +3,7 @@ class Pry
match 'gem-install'
group 'Gems'
description 'Install a gem and refresh the gem cache.'
- command_options :argument_required => true
+ command_options argument_required: true
banner <<-'BANNER'
Usage: gem-install GEM_NAME
diff --git a/lib/pry/commands/gem_open.rb b/lib/pry/commands/gem_open.rb
index 2f0b8d89..79b0d9db 100644
--- a/lib/pry/commands/gem_open.rb
+++ b/lib/pry/commands/gem_open.rb
@@ -3,7 +3,7 @@ class Pry
match 'gem-open'
group 'Gems'
description 'Opens the working directory of the gem in your editor.'
- command_options :argument_required => true
+ command_options argument_required: true
banner <<-'BANNER'
Usage: gem-open GEM_NAME
diff --git a/lib/pry/commands/gist.rb b/lib/pry/commands/gist.rb
index 83cdf2b8..bd055879 100644
--- a/lib/pry/commands/gist.rb
+++ b/lib/pry/commands/gist.rb
@@ -3,7 +3,7 @@ class Pry
match 'gist'
group 'Misc'
description 'Upload code, docs, history to https://gist.github.com/.'
- command_options :requires_gem => "gist"
+ command_options requires_gem: "gist"
banner <<-'BANNER'
Usage: gist [OPTIONS] [--help]
@@ -22,8 +22,8 @@ class Pry
def options(opt)
CodeCollector.inject_options(opt)
opt.on :login, "Authenticate the gist gem with GitHub"
- opt.on :p, :public, "Create a public gist (default: false)", :default => false
- opt.on :clip, "Copy the selected content to clipboard instead, do NOT gist it", :default => false
+ opt.on :p, :public, "Create a public gist (default: false)", default: false
+ opt.on :clip, "Copy the selected content to clipboard instead, do NOT gist it", default: false
end
def process
@@ -81,7 +81,7 @@ class Pry
end
def gist_content(content, filename)
- response = ::Gist.gist(content, :filename => filename || "pry_gist.rb", :public => !!opts[:p])
+ response = ::Gist.gist(content, filename: filename || "pry_gist.rb", public: !!opts[:p])
if response
url = response['html_url']
message = "Gist created at URL #{url}"
diff --git a/lib/pry/commands/hist.rb b/lib/pry/commands/hist.rb
index a1ca241a..3f363005 100644
--- a/lib/pry/commands/hist.rb
+++ b/lib/pry/commands/hist.rb
@@ -21,13 +21,13 @@ class Pry
def options(opt)
opt.on :a, :all, "Display all history"
- opt.on :H, :head, "Display the first N items", :optional_argument => true, :as => Integer
- opt.on :T, :tail, "Display the last N items", :optional_argument => true, :as => Integer
- opt.on :s, :show, "Show the given range of lines", :optional_argument => true, :as => Range
- opt.on :G, :grep, "Show lines matching the given pattern", :argument => true, :as => String
+ opt.on :H, :head, "Display the first N items", optional_argument: true, as: Integer
+ opt.on :T, :tail, "Display the last N items", optional_argument: true, as: Integer
+ opt.on :s, :show, "Show the given range of lines", optional_argument: true, as: Range
+ opt.on :G, :grep, "Show lines matching the given pattern", argument: true, as: String
opt.on :c, :clear , "Clear the current session's history"
- opt.on :r, :replay, "Replay a line or range of lines", :argument => true, :as => Range
- opt.on :save, "Save history to a file", :argument => true, :as => Range
+ opt.on :r, :replay, "Replay a line or range of lines", argument: true, as: Range
+ opt.on :save, "Save history to a file", argument: true, as: Range
opt.on :e, :'exclude-pry', "Exclude Pry commands from the history"
opt.on :n, :'no-numbers', "Omit line numbers"
end
@@ -120,7 +120,7 @@ class Pry
check_for_juxtaposed_replay(replay_sequence)
replay_sequence.lines.each do |line|
- _pry_.eval line, :generated => true
+ _pry_.eval line, generated: true
end
end
diff --git a/lib/pry/commands/ls.rb b/lib/pry/commands/ls.rb
index 65f25af0..da5961d2 100644
--- a/lib/pry/commands/ls.rb
+++ b/lib/pry/commands/ls.rb
@@ -2,31 +2,31 @@ require 'pry/commands/ls/ls_entity'
class Pry
class Command::Ls < Pry::ClassCommand
DEFAULT_OPTIONS = {
- :heading_color => :bright_blue,
- :public_method_color => :default,
- :private_method_color => :blue,
- :protected_method_color => :blue,
- :method_missing_color => :bright_red,
- :local_var_color => :yellow,
- :pry_var_color => :default, # e.g. _, _pry_, _file_
- :instance_var_color => :blue, # e.g. @foo
- :class_var_color => :bright_blue, # e.g. @@foo
- :global_var_color => :default, # e.g. $CODERAY_DEBUG, $eventmachine_library
- :builtin_global_color => :cyan, # e.g. $stdin, $-w, $PID
- :pseudo_global_color => :cyan, # e.g. $~, $1..$9, $LAST_MATCH_INFO
- :constant_color => :default, # e.g. VERSION, ARGF
- :class_constant_color => :blue, # e.g. Object, Kernel
- :exception_constant_color => :magenta, # e.g. Exception, RuntimeError
- :unloaded_constant_color => :yellow, # Any constant that is still in .autoload? state
- :separator => " ",
- :ceiling => [Object, Module, Class]
+ heading_color: :bright_blue,
+ public_method_color: :default,
+ private_method_color: :blue,
+ protected_method_color: :blue,
+ method_missing_color: :bright_red,
+ local_var_color: :yellow,
+ pry_var_color: :default, # e.g. _, _pry_, _file_
+ instance_var_color: :blue, # e.g. @foo
+ class_var_color: :bright_blue, # e.g. @@foo
+ global_var_color: :default, # e.g. $CODERAY_DEBUG, $eventmachine_library
+ builtin_global_color: :cyan, # e.g. $stdin, $-w, $PID
+ pseudo_global_color: :cyan, # e.g. $~, $1..$9, $LAST_MATCH_INFO
+ constant_color: :default, # e.g. VERSION, ARGF
+ class_constant_color: :blue, # e.g. Object, Kernel
+ exception_constant_color: :magenta, # e.g. Exception, RuntimeError
+ unloaded_constant_color: :yellow, # Any constant that is still in .autoload? state
+ separator: " ",
+ ceiling: [Object, Module, Class]
}
match 'ls'
group 'Context'
description 'Show the list of vars and methods in the current scope.'
- command_options :shellwords => false, :interpolate => false
+ command_options shellwords: false, interpolate: false
banner <<-'BANNER'
Usage: ls [-m|-M|-p|-pM] [-q|-v] [-c|-i] [Object]
@@ -60,7 +60,7 @@ class Pry
opt.on :c, :constants, "Show constants, highlighting classes (in blue), and exceptions (in purple).\n" <<
" " * 32 << "Constants that are pending autoload? are also shown (in yellow)"
opt.on :i, :ivars, "Show instance variables (in blue) and class variables (in bright blue)"
- opt.on :G, :grep, "Filter output by regular expression", :argument => true
+ opt.on :G, :grep, "Filter output by regular expression", argument: true
if Object.respond_to?(:deprecate_constant)
opt.on :d, :dconstants, "Show deprecated constants"
end
@@ -80,11 +80,11 @@ class Pry
@interrogatee = args.empty? ? target_self : target.eval(args.join(' '))
raise_errors_if_arguments_are_weird
ls_entity = LsEntity.new({
- :interrogatee => @interrogatee,
- :no_user_opts => no_user_opts?,
- :opts => opts,
- :args => args,
- :_pry_ => _pry_
+ interrogatee: @interrogatee,
+ no_user_opts: no_user_opts?,
+ opts: opts,
+ args: args,
+ _pry_: _pry_
})
_pry_.pager.page ls_entity.entities_table
diff --git a/lib/pry/commands/play.rb b/lib/pry/commands/play.rb
index eb8b7a6e..f2faf7f8 100644
--- a/lib/pry/commands/play.rb
+++ b/lib/pry/commands/play.rb
@@ -31,7 +31,7 @@ class Pry
' "open". `amend-line` can then be used to' \
' modify the method.'
- opt.on :e, :expression=, 'Executes until end of valid expression', :as => Integer
+ opt.on :e, :expression=, 'Executes until end of valid expression', as: Integer
opt.on :p, :print, 'Prints executed code'
end
diff --git a/lib/pry/commands/raise_up.rb b/lib/pry/commands/raise_up.rb
index 70ad0872..53475c6b 100644
--- a/lib/pry/commands/raise_up.rb
+++ b/lib/pry/commands/raise_up.rb
@@ -4,7 +4,7 @@ class Pry
match(/raise-up(!?\b.*)/)
group 'Context'
description 'Raise an exception out of the current pry instance.'
- command_options :listing => 'raise-up'
+ command_options listing: 'raise-up'
banner <<-BANNER
Raise up, like exit, allows you to quit pry. Instead of returning a value
diff --git a/lib/pry/commands/ri.rb b/lib/pry/commands/ri.rb
index 34fbf7b6..0e7cb5d1 100644
--- a/lib/pry/commands/ri.rb
+++ b/lib/pry/commands/ri.rb
@@ -50,7 +50,7 @@ class Pry
end
# Spin-up an RI insance.
- ri = RDoc::RI::PryDriver.new _pry_.pager, :use_stdout => true, :interactive => false
+ ri = RDoc::RI::PryDriver.new _pry_.pager, use_stdout: true, interactive: false
begin
ri.display_names [spec] # Get the documentation (finally!)
diff --git a/lib/pry/commands/shell_command.rb b/lib/pry/commands/shell_command.rb
index e6365483..1052dfe0 100644
--- a/lib/pry/commands/shell_command.rb
+++ b/lib/pry/commands/shell_command.rb
@@ -3,8 +3,8 @@ class Pry
match(/\.(.*)/)
group 'Input and Output'
description "All text following a '.' is forwarded to the shell."
- command_options :listing => '.<shell command>', :use_prefix => false,
- :takes_block => true
+ command_options listing: '.<shell command>', use_prefix: false,
+ takes_block: true
banner <<-'BANNER'
Usage: .COMMAND_NAME
diff --git a/lib/pry/commands/show_doc.rb b/lib/pry/commands/show_doc.rb
index 4969bcdc..2fa74feb 100644
--- a/lib/pry/commands/show_doc.rb
+++ b/lib/pry/commands/show_doc.rb
@@ -62,7 +62,7 @@ class Pry
# Which sections to include in the 'header', can toggle: :owner,
# :signature and visibility.
def header_options
- super.merge :signature => true
+ super.merge signature: true
end
# figure out start line of docs by back-calculating based on
diff --git a/lib/pry/commands/show_info.rb b/lib/pry/commands/show_info.rb
index 374169fe..62a47dae 100644
--- a/lib/pry/commands/show_info.rb
+++ b/lib/pry/commands/show_info.rb
@@ -2,7 +2,7 @@ class Pry
class Command::ShowInfo < Pry::ClassCommand
extend Pry::Helpers::BaseHelpers
- command_options :shellwords => false, :interpolate => false
+ command_options shellwords: false, interpolate: false
def initialize(*)
super
@@ -11,14 +11,14 @@ class Pry
end
def options(opt)
- opt.on :s, :super, "Select the 'super' method. Can be repeated to traverse the ancestors", :as => :count
+ opt.on :s, :super, "Select the 'super' method. Can be repeated to traverse the ancestors", as: :count
opt.on :l, "line-numbers", "Show line numbers"
opt.on :b, "base-one", "Show line numbers but start numbering at 1 (useful for `amend-line` and `play` commands)"
opt.on :a, :all, "Show all definitions and monkeypatches of the module/class"
end
def process
- code_object = Pry::CodeObject.lookup(obj_name, _pry_, :super => opts[:super])
+ code_object = Pry::CodeObject.lookup(obj_name, _pry_, super: opts[:super])
raise CommandError, no_definition_message if !code_object
@original_code_object = code_object
@@ -151,17 +151,17 @@ class Pry
def method_sections(code_object)
{
- :owner => "\n#{bold("Owner:")} #{code_object.owner || "N/A"}\n",
- :visibility => "#{bold("Visibility:")} #{code_object.visibility}",
- :signature => "\n#{bold("Signature:")} #{code_object.signature}"
+ owner: "\n#{bold("Owner:")} #{code_object.owner || "N/A"}\n",
+ visibility: "#{bold("Visibility:")} #{code_object.visibility}",
+ signature: "\n#{bold("Signature:")} #{code_object.signature}"
}.merge(header_options) { |key, old, new| (new && old).to_s }
end
def header_options
{
- :owner => true,
- :visibility => true,
- :signature => nil
+ owner: true,
+ visibility: true,
+ signature: nil
}
end
diff --git a/lib/pry/commands/stat.rb b/lib/pry/commands/stat.rb
index 06a191b5..00a5d713 100644
--- a/lib/pry/commands/stat.rb
+++ b/lib/pry/commands/stat.rb
@@ -3,7 +3,7 @@ class Pry
match 'stat'
group 'Introspection'
description 'View method information and set _file_ and _dir_ locals.'
- command_options :shellwords => false
+ command_options shellwords: false
banner <<-'BANNER'
Usage: stat [OPTIONS] [METH]
diff --git a/lib/pry/commands/watch_expression.rb b/lib/pry/commands/watch_expression.rb
index f7d369d3..673d3801 100644
--- a/lib/pry/commands/watch_expression.rb
+++ b/lib/pry/commands/watch_expression.rb
@@ -5,7 +5,7 @@ class Pry
match 'watch'
group 'Context'
description 'Watch the value of an expression and print a notification whenever it changes.'
- command_options :use_prefix => false
+ command_options use_prefix: false
banner <<-'BANNER'
Usage: watch [EXPRESSION]
@@ -29,7 +29,7 @@ class Pry
def options(opt)
opt.on :d, :delete,
"Delete the watch expression with the given index. If no index is given; clear all watch expressions.",
- :optional_argument => true, :as => Integer
+ optional_argument: true, as: Integer
opt.on :l, :list,
"Show all current watch expressions and their values. Calling watch with no expressions or options will also show the watch expressions."
end
diff --git a/lib/pry/commands/wtf.rb b/lib/pry/commands/wtf.rb
index 43950a33..0005d518 100644
--- a/lib/pry/commands/wtf.rb
+++ b/lib/pry/commands/wtf.rb
@@ -3,7 +3,7 @@ class Pry
match(/wtf([?!]*)/)
group 'Context'
description 'Show the backtrace of the most recent exception.'
- options :listing => 'wtf?'
+ options listing: 'wtf?'
banner <<-'BANNER'
Usage: wtf[?|!]
diff --git a/lib/pry/helpers/options_helpers.rb b/lib/pry/helpers/options_helpers.rb
index 09fd0262..bdd007f1 100644
--- a/lib/pry/helpers/options_helpers.rb
+++ b/lib/pry/helpers/options_helpers.rb
@@ -8,8 +8,8 @@ class Pry
@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|
+ 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
@@ -17,9 +17,9 @@ class Pry
# 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')
+ super: opts[:super],
+ instance: opts.present?(:'instance-methods') && !opts.present?(:'methods'),
+ methods: opts.present?(:'methods') && !opts.present?(:'instance-methods')
)
end
end
diff --git a/lib/pry/helpers/table.rb b/lib/pry/helpers/table.rb
index 56e7e59b..7bb7bbf0 100644
--- a/lib/pry/helpers/table.rb
+++ b/lib/pry/helpers/table.rb
@@ -2,11 +2,11 @@ class Pry
module Helpers
def self.tablify_or_one_line(heading, things)
plain_heading = Pry::Helpers::Text.strip_color(heading)
- attempt = Table.new(things, :column_count => things.size)
+ attempt = Table.new(things, column_count: things.size)
if attempt.fits_on_line?(Terminal.width! - plain_heading.size - 2)
"#{heading}: #{attempt}\n"
else
- "#{heading}: \n#{tablify_to_screen_width(things, :indent => ' ')}\n"
+ "#{heading}: \n#{tablify_to_screen_width(things, indent: ' ')}\n"
end
end
@@ -21,7 +21,7 @@ class Pry
end
def self.tablify(things, line_length)
- table = Table.new(things, :column_count => things.size)
+ table = Table.new(things, column_count: things.size)
table.column_count -= 1 until 1 == table.column_count or
table.fits_on_line?(line_length)
table
diff --git a/lib/pry/method.rb b/lib/pry/method.rb
index 3fb5da7f..1ab8cd36 100644
--- a/lib/pry/method.rb
+++ b/lib/pry/method.rb
@@ -56,8 +56,8 @@ class Pry
elsif options[:methods]
from_obj(target.eval("self"), name, target)
else
- from_str(name, target, :instance => true) or
- from_str(name, target, :methods => true)
+ from_str(name, target, instance: true) or
+ from_str(name, target, methods: true)
end
rescue Pry::RescuableException
@@ -142,7 +142,7 @@ class Pry
def all_from_class(klass, include_super=true)
%w(public protected private).flat_map do |visibility|
safe_send(klass, :"#{visibility}_instance_methods", include_super).map do |method_name|
- new(safe_send(klass, :instance_method, method_name), :visibility => visibility.to_sym)
+ new(safe_send(klass, :instance_method, method_name), visibility: visibility.to_sym)
end
end
end
diff --git a/lib/pry/pry_class.rb b/lib/pry/pry_class.rb
index c93e5fec..c3a63b6b 100644
--- a/lib/pry/pry_class.rb
+++ b/lib/pry/pry_class.rb
@@ -276,17 +276,17 @@ you can add "Pry.config.windows_console_warning = false" to your pryrc.
# Pry.run_command "ls -av", :show_output => true
def self.run_command(command_string, options={})
options = {
- :target => TOPLEVEL_BINDING,
- :show_output => true,
- :output => Pry.config.output,
- :commands => Pry.config.commands
+ target: TOPLEVEL_BINDING,
+ show_output: true,
+ output: Pry.config.output,
+ commands: Pry.config.commands
}.merge!(options)
# :context for compatibility with <= 0.9.11.4
target = options[:context] || options[:target]
output = options[:show_output] ? options[:output] : StringIO.new
- pry = Pry.new(:output => output, :target => target, :commands => options[:commands])
+ pry = Pry.new(output: output, target: target, commands: options[:commands])
pry.eval command_string
nil
end
diff --git a/lib/pry/pry_instance.rb b/lib/pry/pry_instance.rb
index 2efba07a..ea3ecb5b 100644
--- a/lib/pry/pry_instance.rb
+++ b/lib/pry/pry_instance.rb
@@ -345,7 +345,7 @@ class Pry
# (If nested sessions are going to exist, this method is fine, but a goal is
# to come up with an alternative to nested sessions altogether.)
def repl(target = nil)
- Pry::REPL.new(self, :target => target).start
+ Pry::REPL.new(self, target: target).start
end
def evaluate_ruby(code)
@@ -403,11 +403,11 @@ class Pry
val = val.lstrip if /^\s\S/ !~ val
val = val.chomp
result = commands.process_line(val,
- :target => current_binding,
- :output => output,
- :eval_string => @eval_string,
- :pry_instance => self,
- :hooks => hooks
+ target: current_binding,
+ output: output,
+ eval_string: @eval_string,
+ pry_instance: self,
+ hooks: hooks
)
# set a temporary (just so we can inject the value we want into eval_string)
@@ -448,10 +448,10 @@ class Pry
# pry_instance.run_command("ls -m")
def run_command(val)
commands.process_line(val,
- :eval_string => @eval_string,
- :target => current_binding,
- :pry_instance => self,
- :output => output
+ eval_string: @eval_string,
+ target: current_binding,
+ pry_instance: self,
+ output: output
)
Pry::Command::VOID_VALUE
end
@@ -533,17 +533,17 @@ class Pry
@indent.stack.last
c = Pry::Config.assign({
- :object => object,
- :nesting_level => binding_stack.size - 1,
- :open_token => open_token,
- :session_line => Pry.history.session_line_count + 1,
- :history_line => Pry.history.history_line_count + 1,
- :expr_number => input_array.count,
- :_pry_ => self,
- :binding_stack => binding_stack,
- :input_array => input_array,
- :eval_string => @eval_string,
- :cont => !@eval_string.empty?
+ object: object,
+ nesting_level: binding_stack.size - 1,
+ open_token: open_token,
+ session_line: Pry.history.session_line_count + 1,
+ history_line: Pry.history.history_line_count + 1,
+ expr_number: input_array.count,
+ _pry_: self,
+ binding_stack: binding_stack,
+ input_array: input_array,
+ eval_string: @eval_string,
+ cont: !@eval_string.empty?
})
Pry.critical_section do
diff --git a/lib/pry/repl_file_loader.rb b/lib/pry/repl_file_loader.rb
index e4296291..84faad25 100644
--- a/lib/pry/repl_file_loader.rb
+++ b/lib/pry/repl_file_loader.rb
@@ -42,7 +42,7 @@ class Pry
end
content.lines.each do |line|
- break unless _pry_.eval line, :generated => true
+ break unless _pry_.eval line, generated: true
end
unless _pry_.eval_string.empty?
diff --git a/lib/pry/rubygem.rb b/lib/pry/rubygem.rb
index 5c84a325..33af7c01 100644
--- a/lib/pry/rubygem.rb
+++ b/lib/pry/rubygem.rb
@@ -67,7 +67,7 @@ class Pry
else
Gem.user_dir
end
- installer = Gem::DependencyInstaller.new(:install_dir => destination)
+ installer = Gem::DependencyInstaller.new(install_dir: destination)
installer.install(name)
rescue Errno::EACCES
raise CommandError,
diff --git a/lib/pry/slop.rb b/lib/pry/slop.rb
index b11c37b1..4afbfd87 100644
--- a/lib/pry/slop.rb
+++ b/lib/pry/slop.rb
@@ -24,15 +24,15 @@ class Pry::Slop
# Returns a default Hash of configuration options this Slop instance uses.
DEFAULT_OPTIONS = {
- :strict => false,
- :help => false,
- :banner => nil,
- :ignore_case => false,
- :autocreate => false,
- :arguments => false,
- :optional_arguments => false,
- :multiple_switches => true,
- :longest_flag => 0
+ strict: false,
+ help: false,
+ banner: nil,
+ ignore_case: false,
+ autocreate: false,
+ arguments: false,
+ optional_arguments: false,
+ multiple_switches: true,
+ longest_flag: 0
}
class << self
@@ -135,7 +135,7 @@ class Pry::Slop
end
if config[:help]
- on('-h', '--help', 'Display this help message.', :tail => true) do
+ on('-h', '--help', 'Display this help message.', tail: true) do
$stderr.puts help
end
end
diff --git a/lib/pry/slop/option.rb b/lib/pry/slop/option.rb
index 236939de..b574b1e8 100644
--- a/lib/pry/slop/option.rb
+++ b/lib/pry/slop/option.rb
@@ -3,18 +3,18 @@ class Pry::Slop
# The default Hash of configuration options this class uses.
DEFAULT_OPTIONS = {
- :argument => false,
- :optional_argument => false,
- :tail => false,
- :default => nil,
- :callback => nil,
- :delimiter => ',',
- :limit => 0,
- :match => nil,
- :optional => true,
- :required => false,
- :as => String,
- :autocreated => false
+ argument: false,
+ optional_argument: false,
+ tail: false,
+ default: nil,
+ callback: nil,
+ delimiter: ',',
+ limit: 0,
+ match: nil,
+ optional: true,
+ required: false,
+ as: String,
+ autocreated: false
}
attr_reader :short, :long, :description, :config, :types
@@ -41,12 +41,12 @@ class Pry::Slop
@value = nil
@types = {
- :string => proc { |v| v.to_s },
- :symbol => proc { |v| v.to_sym },
- :integer => proc { |v| value_to_integer(v) },
- :float => proc { |v| value_to_float(v) },
- :range => proc { |v| value_to_range(v) },
- :count => proc { |v| @count }
+ string: proc { |v| v.to_s },
+ symbol: proc { |v| v.to_sym },
+ integer: proc { |v| value_to_integer(v) },
+ float: proc { |v| value_to_float(v) },
+ range: proc { |v| value_to_range(v) },
+ count: proc { |v| @count }
}
if long && long.size > @slop.config[:longest_flag]
diff --git a/lib/pry/testable/mockable.rb b/lib/pry/testable/mockable.rb
index 2b3d7581..1e3a23d9 100644
--- a/lib/pry/testable/mockable.rb
+++ b/lib/pry/testable/mockable.rb
@@ -2,7 +2,7 @@ module Pry::Testable::Mockable
def mock_command(cmd, args=[], opts={})
output = StringIO.new
pry = Pry.new(output: output)
- ret = cmd.new(opts.merge(pry_instance: pry, :output => output)).call_safely(*args)
+ ret = cmd.new(opts.merge(pry_instance: pry, output: output)).call_safely(*args)
Struct.new(:output, :return).new(output.string, ret)
end
diff --git a/lib/pry/testable/pry_tester.rb b/lib/pry/testable/pry_tester.rb
index 39d32dce..76b5555e 100644
--- a/lib/pry/testable/pry_tester.rb
+++ b/lib/pry/testable/pry_tester.rb
@@ -4,7 +4,7 @@ class Pry::Testable::PryTester
def_delegators :@pry, :eval_string, :eval_string=
def initialize(target = TOPLEVEL_BINDING, options = {})
- @pry = Pry.new(options.merge(:target => target))
+ @pry = Pry.new(options.merge(target: target))
@history = options[:history]
@pry.inject_sticky_locals!
reset_output