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

Revert "Add headings for methods in the output of ls"

This reverts commit 1c33a73964.

Looks unpleasant for most of Pry users.
This commit is contained in:
Kyrylo Silin 2013-01-14 05:04:29 +02:00
parent cee34d944f
commit dac10c6437

View file

@ -326,9 +326,6 @@ class Pry
def output_section(heading, body)
return "" if body.compact.empty?
table = Pry::Helpers.tablify_to_screen_width(body)
if heading =~ /.+methods\z/ && body.size >= 36
paint_heading_methods(body)
end
"#{text.bold(color(:heading, heading))}: \n#{table}\n"
end
@ -336,22 +333,6 @@ class Pry
def color(type, str)
text.send(Pry.config.ls.send(:"#{type}_color"), str)
end
# The true place for this method is {Pry::Helpers::Table}. Both JRuby and
# Rubinius don't like it when it's there, for some reason. *shrugs*
def paint_heading_methods(body)
cur = ''
body.each_with_index.inject([]) { |indices, (method, idx)|
if method[0] != cur && method[0] =~ /[a-z]/
indices << idx
cur = method[0]
end
indices
}.map { |i|
body[i][0] = "\e[1;7m#{ body[i][0] }\e[0m"
body[i][11..-1] = "\e[4m#{ body[i][11..-1] }\e[0m"
}
end
end
Pry::Commands.add_command(Pry::Command::Ls)