Method: Pry::Command::ShowInfo#content_and_headers_for_all_module_candidates

Defined in:
lib/pry/commands/show_info.rb

#content_and_headers_for_all_module_candidates(mod) ⇒ Object



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/pry/commands/show_info.rb', line 81

def content_and_headers_for_all_module_candidates(mod)
  result = "Found #{mod.number_of_candidates} candidates for " \
           "`#{mod.name}` definition:\n"
  mod.number_of_candidates.times do |v|
    candidate = mod.candidate(v)
    begin
      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
    rescue Pry::RescuableException
      result += "\nNo content found.\n"
      next
    end
  end
  result
end