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

Config: wrap everything at 80 characters

Conflicts:
	lib/pry/config.rb
This commit is contained in:
Kyrylo Silin 2013-02-25 08:50:32 +02:00
parent c4254d84a6
commit d4faf1eb74

View file

@ -4,9 +4,10 @@ class Pry
class Config < OpenStruct
# Get/Set the object to use for input by default by all Pry instances.
# Pry.config.input is an option determining the input object - the object from
# which Pry retrieves its lines of input. Pry accepts any object that implements the readline method.
# This includes IO objects, StringIO, Readline, File and custom objects.
# Pry.config.input is an option determining the input object - the object
# from which Pry retrieves its lines of input. Pry accepts any object that
# implements the readline method. This includes IO objects, StringIO,
# Readline, File and custom objects.
# @return [#readline] The object to use for input by default by all
# Pry instances.
# @example
@ -14,9 +15,9 @@ class Pry
attr_accessor :input
# Get/Set the object to use for output by default by all Pry instances.
# Pry.config.output is an option determining the output object - the object to which
# Pry writes its output. Pry accepts any object that implements the puts method. This
# includes IO objects, StringIO, File and custom objects.
# Pry.config.output is an option determining the output object - the object
# to which Pry writes its output. Pry accepts any object that implements the
# puts method. This includes IO objects, StringIO, File and custom objects.
# @return [#puts] The object to use for output by default by all
# Pry instances.
# @example
@ -24,36 +25,36 @@ class Pry
attr_accessor :output
# Get/Set the object to use for commands by default by all Pry instances.
# @return [Pry::CommandBase] The object to use for commands by default by all
# Pry instances.
# @return [Pry::CommandBase] The object to use for commands by default by
# all Pry instances.
# @example
# Pry.config.commands = Pry::CommandSet.new do
# import_from Pry::Commands, "ls"
#
# command "greet" do |name|
# output.puts "hello #{name}"
# end
# end
# import_from Pry::Commands, "ls"
# command "greet" do |name|
# output.puts "hello #{name}"
# end
# end
attr_accessor :commands
# Get/Set the Proc to use for printing by default by all Pry
# instances.
# Two parameters are passed to the print Proc: these are (1) the
# output object for the current session and (2) the expression value to print. It is important
# that you write to the output object instead of just stdout so that all Pry output can be redirected if necessary.
# This is the 'print' component of the REPL.
# output object for the current session and (2) the expression value to
# print. It is important that you write to the output object instead of just
# stdout so that all Pry output can be redirected if necessary. This is the
# 'print' component of the REPL.
# @return [Proc] The Proc to use for printing by default by all
# Pry instances.
# @example
# Pry.config.print = proc { |output, value| output.puts "=> #{value.inspect}" }
attr_accessor :print
# Pry.config.exception_handler is an option determining the exception handler object - the
# Proc responsible for dealing with exceptions raised by user input to the REPL.
# Three parameters are passed to the exception handler Proc: these
# are (1) the output object for the current session, (2) the
# exception object that was raised inside the Pry session, and (3)
# a reference to the associated Pry instance.
# Pry.config.exception_handler is an option determining the exception
# handler object - the Proc responsible for dealing with exceptions raised
# by user input to the REPL. Three parameters are passed to the exception
# handler Proc: these are (1) the output object for the current session, (2)
# the exception object that was raised inside the Pry session, and (3) a
# reference to the associated Pry instance.
# @return [Proc] The Proc to use for printing exceptions by default by all
# Pry instances.
# @example
@ -74,12 +75,12 @@ class Pry
# Pry.config.default_window_size = 10
attr_accessor :default_window_size
# Get/Set the `Pry::Hooks` instance that defines Pry hooks used by default by all Pry
# instances.
# Get/Set the `Pry::Hooks` instance that defines Pry hooks used by default
# by all Pry instances.
# @return [Pry::Hooks] The hooks used by default by all Pry instances.
# @example
# Pry.config.hooks = Pry::Hooks.new.add_hook(:before_session,
# :default) { |output, target, _pry_| output.puts "Good morning!" }
# :default) { |output, target, _pry_| output.puts "Good morning!" }
attr_reader :hooks
# FIXME:
@ -94,40 +95,42 @@ class Pry
end
end
# Get the array of Procs (or single Proc) to be used for the prompts by default by
# all Pry instances.
# Three parameters are passed into the prompt procs, (1) the
# object that is the target of the session, (2) the current
# nesting level, and (3) a reference to the associated Pry instance. These objects can be used in the prompt, if desired.
# Get the array of Procs (or single Proc) to be used for the prompts by
# default by all Pry instances. Three parameters are passed into the prompt
# procs, (1) the object that is the target of the session, (2) the current
# nesting level, and (3) a reference to the associated Pry instance. These
# objects can be used in the prompt, if desired.
# @return [Array<Proc>, Proc] The array of Procs to be used for the
# prompts by default by all Pry instances.
# @example
# Pry.config.prompt = proc { |obj, nest_level, _pry_| "#{obj}:#{nest_level}> " }
attr_accessor :prompt
# The display name that is part of the prompt. Default is 'pry'.
# You can set your own name so you can identify which project your current pry session
# is using. This is useful if you have a local pryrc file in a Rails project for example.
# The display name that is part of the prompt. Default is 'pry'. You can
# set your own name so you can identify which project your current pry
# session is using. This is useful if you have a local pryrc file in a
# Rails project for example.
# @return [String]
# @example
# @example
# Pry.config.prompt_name = 'my_rails_project'
attr_accessor :prompt_name
# The default editor to use. Defaults to $VISUAL, $EDITOR, or a sensible fallback
# for the platform.
# If `editor` is a String then that string is used as the shell
# command to invoke the editor. If `editor` is callable (e.g a
# Proc) then `file`, `line`, and `reloading` are passed in as parameters and the
# return value of that callable invocation is used as the exact
# shell command to invoke the editor. `reloading` indicates whether Pry will be
# reloading code after the shell command returns. Any or all of these parameters
# can be omitted from the callable's signature.
# The default editor to use. Defaults to $VISUAL, $EDITOR, or a sensible
# fallback for the platform. If `editor` is a String then that string is
# used as the shell command to invoke the editor. If `editor` is callable
# (e.g a Proc) then `file`, `line`, and `reloading` are passed in as
# parameters and the return value of that callable invocation is used as the
# exact shell command to invoke the editor. `reloading` indicates whether
# Pry will be reloading code after the shell command returns. Any or all of
# these parameters can be omitted from the callable's signature.
# @example String
# Pry.config.editor = "emacsclient"
# @example Callable
# Pry.config.editor = proc { |file, line| "emacsclient #{file} +#{line}" }
# @example Callable waiting only if reloading
# Pry.config.editor = proc { |file, line, reloading| "subl #{'--wait' if reloading} #{file}:#{line}" }
# Pry.config.editor = proc { |file, line, reloading|
# "subl #{'--wait' if reloading} #{file}:#{line}"
# }
# @return [String, #call]
attr_accessor :editor
@ -181,11 +184,13 @@ class Pry
# Config option for plugins:
# sub-options include:
# `plugins.strict_loading` (Boolean) which toggles whether referring to a non-existent plugin should raise an exception (defaults to `false`)
# `plugins.strict_loading` (Boolean) which toggles whether referring to a
# non-existent plugin should raise an exception (defaults to `false`).
# @return [OpenStruct]
attr_accessor :plugins
# @return [Array<String>] Ruby files to be required after loading any plugins.
# @return [Array<String>] Ruby files to be required after loading
# any plugins.
attr_accessor :requires
# @return [Integer] Amount of results that will be stored into out
@ -212,7 +217,6 @@ class Pry
# a command name collides with a method/local in the current context.
attr_accessor :collision_warning
# Config option for gist.
# sub-options include `gist.inspecter`,
# `gist.inspecter` is a callable that defines how the expression output
@ -224,7 +228,8 @@ class Pry
# @return [OpenStruct]
attr_accessor :gist
# @return [Hash] Additional sticky locals (to the standard ones) to use in Pry sessions.
# @return [Hash] Additional sticky locals (to the standard ones) to use in
# Pry sessions.
# @example Inject `random_number` sticky local into Pry session
# Pry.config.extra_sticky_locals = { :random_number => proc {
# rand(10) } }