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

Get rid of Code#highlighted

This commit is contained in:
Conrad Irwin 2014-05-09 20:16:02 -07:00
parent 5591367c26
commit 5599b0a976
6 changed files with 8 additions and 13 deletions

View file

@ -253,12 +253,7 @@ class Pry
# @return [String] a formatted representation (based on the configuration of
# the object).
def to_s
print_to_output("", false)
end
# @return [String] a (possibly highlighted) copy of the source code.
def highlighted
print_to_output("", true)
print_to_output("")
end
# Writes a formatted representation (based on the configuration of the
@ -266,7 +261,7 @@ class Pry
def print_to_output(output, color=false)
@lines.each do |loc|
loc = loc.dup
loc.colorize(@code_type) if color
loc.colorize(@code_type)
loc.add_line_number(max_lineno_width, color) if @with_line_numbers
loc.add_marker(@marker_lineno) if @with_marker
loc.indent(@indentation_num) if @with_indentation

View file

@ -8,7 +8,7 @@ class Pry
def decorate(content)
content.code_type = code_type
content.between(*between_lines).
with_line_numbers(use_line_numbers?).highlighted
with_line_numbers(use_line_numbers?)
end
def code_type

View file

@ -40,7 +40,7 @@ class Pry
# The source for code_object prepared for display.
def content_for(code_object)
Code.new(code_object.source, start_line_for(code_object)).
with_line_numbers(use_line_numbers?).highlighted
with_line_numbers(use_line_numbers?)
end
end

View file

@ -88,7 +88,7 @@ class Pry
def add_expression(arguments)
expressions << Expression.new(_pry_, target, arg_string)
output.puts "Watching #{Code.new(arg_string).highlighted}"
output.puts "Watching #{Code.new(arg_string)}"
end
def add_hook

View file

@ -6,7 +6,7 @@ class Pry
def initialize(_pry_, target, source)
@_pry_ = _pry_
@target = target
@source = Code.new(source).strip
@source = source.strip
end
def eval!
@ -15,7 +15,7 @@ class Pry
end
def to_s
"#{Code.new(source).highlighted.strip} => #{value}"
"#{Code.new(source).strip} => #{value}"
end
# Has the value of the expression changed?

View file

@ -89,7 +89,7 @@ class Pry
set_file_and_dir_locals(@file)
out = "\n#{text.bold('From:')} #{location}:\n\n" <<
code.with_line_numbers(use_line_numbers?).with_marker(marker).highlighted << "\n"
code.with_line_numbers(use_line_numbers?).with_marker(marker) << "\n"
_pry_.pager.page out
end