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:
parent
5591367c26
commit
5599b0a976
6 changed files with 8 additions and 13 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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?
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue