fixed some style issues; renamed Pry.config.indent to Pry.config.auto_indent

This commit is contained in:
John Mair 2011-10-09 00:40:55 +13:00
parent bdd0759c7e
commit 8ca04c22df
5 changed files with 21 additions and 20 deletions

View File

@ -127,9 +127,9 @@ class Pry
# to eval, and a reference to the pry instance
attr_accessor :system
# @return [TrueClass|FalseClass] Whether or not code should be indented
# @return [Boolean] Whether or not code should be indented
# using Pry::Indent.
attr_accessor :indent
attr_accessor :auto_indent
end
end

View File

@ -16,7 +16,7 @@ class Pry
attr_reader :stack
# The amount of spaces to insert for each indent level.
Spaces = ' '.freeze
Spaces = ' '
# Array containing all the tokens that should increase the indentation
# level.

View File

@ -192,7 +192,7 @@ class Pry
config.should_load_rc = true
config.disable_auto_reload = false
config.command_prefix = ""
config.indent = true
config.auto_indent = true
config.plugins ||= OpenStruct.new
config.plugins.enabled = true
@ -209,16 +209,16 @@ class Pry
config.memory_size = 100
Pry.config.ls ||= OpenStruct.new
Pry.config.ls.local_var_color = :bright_red
Pry.config.ls.instance_var_color = :bright_blue
Pry.config.ls.class_var_color = :blue
Pry.config.ls.global_var_color = :bright_magenta
Pry.config.ls.method_color = :green
Pry.config.ls.instance_method_color = :bright_green
Pry.config.ls.constant_color = :yellow
config.ls ||= OpenStruct.new
config.ls.local_var_color = :bright_red
config.ls.instance_var_color = :bright_blue
config.ls.class_var_color = :blue
config.ls.global_var_color = :bright_magenta
config.ls.method_color = :green
config.ls.instance_method_color = :bright_green
config.ls.constant_color = :yellow
Pry.config.ls.separator = " "
config.ls.separator = " "
end
# Set all the configurable options back to their default values

View File

@ -278,8 +278,9 @@ class Pry
end
# Read a line of input and check for ^d, also determine prompt to use.
# This method should not need to be invoked directly. This method
# automatically indents the input value using Pry::Indent.
# This method should not need to be invoked directly. This method also
# automatically indents the input value using Pry::Indent if auto
# indenting is enabled.
#
# @param [String] eval_string The cumulative lines of input.
# @param [Binding] target The target of the session.
@ -293,7 +294,7 @@ class Pry
output.puts ""
Pry.config.control_d_handler.call(eval_string, self)
return ""
""
else
# Change the eval_string into the input encoding (Issue 284)
@ -303,11 +304,11 @@ class Pry
eval_string.force_encoding(val.encoding)
end
if Pry.config.indent
if Pry.config.auto_indent
val = @indent.indent(val)
end
return val
val
end
end
@ -427,7 +428,7 @@ class Pry
# @param [String] current_prompt The prompt to use for input.
# @return [String] The next line of input.
def readline(current_prompt="> ")
if Pry.config.indent
if Pry.config.auto_indent
current_prompt += @indent.stack[-1] || ''
end

View File

@ -24,7 +24,7 @@ class << Pry
Pry.config.plugins.enabled = false
Pry.config.history.should_load = false
Pry.config.history.should_save = false
Pry.config.indent = false
Pry.config.auto_indent = false
Pry.config.hooks = { }
end
end