Change formatting of "file.rb @ line 1" to "file.rb:1"

This is how Ruby formats line numbers. It's more concisce and still
understandable.
This commit is contained in:
Kyrylo Silin 2019-01-13 15:24:15 +08:00
parent 1d463198a9
commit 2178dc2405
5 changed files with 9 additions and 9 deletions

View File

@ -216,7 +216,7 @@ instance methods beginning with 're' and display the source code for the `rep` m
Pry#methods: re readline refresh rep repl repl_epilogue repl_prologue retrieve_line
pry(Pry):1> show-method rep -l
From: /home/john/ruby/projects/pry/lib/pry/pry_instance.rb @ line 143:
From: /home/john/ruby/projects/pry/lib/pry/pry_instance.rb:143
Number of lines: 6
143: def rep(target=TOPLEVEL_BINDING)
@ -281,7 +281,7 @@ documentation for the `try_activate` method:
pry(main)> cd Gem
pry(Gem):1> show-doc try_activate
From: /Users/john/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb @ line 201:
From: /Users/john/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:201
Number of lines: 3
Try to activate a gem containing path. Returns true if

View File

@ -70,7 +70,7 @@ class Pry
unindent %{
#{bold 'Exception:'} #{ex.class}: #{ex.message}
--
#{bold('From:')} #{backtrace_file} @ line #{backtrace_line} @ #{bold("level: #{backtrace_level}")} of backtrace (of #{ex.backtrace.size - 1}).
#{bold('From:')} #{backtrace_file}:#{backtrace_line} @ #{bold("level: #{backtrace_level}")} of backtrace (of #{ex.backtrace.size - 1}).
}
end

View File

@ -81,7 +81,7 @@ class Pry
mod.number_of_candidates.times do |v|
candidate = mod.candidate(v)
begin
result << "\nCandidate #{v + 1}/#{mod.number_of_candidates}: #{candidate.source_file} @ line #{candidate.source_line}:\n"
result << "\nCandidate #{v + 1}/#{mod.number_of_candidates}: #{candidate.source_file}:#{candidate.source_line}\n"
content = content_for(candidate)
result << "Number of lines: #{content.lines.count}\n\n" << content
@ -103,7 +103,7 @@ class Pry
file_name, line_num = file_and_line_for(code_object)
content = content_for(code_object)
h = "\n#{bold('From:')} #{file_name} "
h = "\n#{bold('From:')} #{file_name}"
h << code_object_header(code_object, line_num)
h << "\n#{bold('Number of lines:')} " << "#{content.lines.count}\n\n"
h << bold('** Warning:') << " Cannot find code for #{@original_code_object.nonblank_name}. Showing superclass #{code_object.nonblank_name} instead. **\n\n" if @used_super
@ -130,7 +130,7 @@ class Pry
def method_header(code_object, line_num)
h = ""
h << (code_object.c_method? ? "(C Method):" : "@ line #{line_num}:")
h << (code_object.c_method? ? "(C Method):" : ":#{line_num}:")
h << method_sections(code_object)[:owner]
h << method_sections(code_object)[:visibility]
h << method_sections(code_object)[:signature]
@ -139,7 +139,7 @@ class Pry
def module_header(code_object, line_num)
h = ""
h << "@ line #{line_num}:\n"
h << ":#{line_num}\n"
h << bold(code_object.module? ? "Module" : "Class")
h << " #{bold('name:')} #{code_object.nonblank_name}"

View File

@ -81,7 +81,7 @@ class Pry
end
def location
"#{@file} @ line #{@line} #{@method && @method.name_with_owner}"
"#{@file}:#{@line} #{@method && @method.name_with_owner}"
end
def process

View File

@ -119,7 +119,7 @@ describe "whereami" do
# proc { Cor.new.blimey! }.should.raise(MethodSource::SourceNotFoundError)
# Pad.tester.last_output.should =~
# /From: not.found.file.erb @ line 7 Cor#blimey!:/
# /From: not.found.file.erb:7 Cor#blimey!/
# Object.remove_const(:Cor)
# end