class Pry::Command::Ls::Formatter
Attributes
grep[W]
pry_instance[R]
Public Class Methods
new(pry_instance)
click to toggle source
# File lib/pry/commands/ls/formatter.rb, line 10 def initialize(pry_instance) @pry_instance = pry_instance @target = pry_instance.current_context @default_switch = nil end
Public Instance Methods
write_out()
click to toggle source
# File lib/pry/commands/ls/formatter.rb, line 16 def write_out return false unless correct_opts? output_self end
Private Instance Methods
color(type, str)
click to toggle source
# File lib/pry/commands/ls/formatter.rb, line 24 def color(type, str) Pry::Helpers::Text.send pry_instance.config.ls.send("#{type}_color"), str end
correct_opts?()
click to toggle source
# File lib/pry/commands/ls/formatter.rb, line 41 def correct_opts? @default_switch end
format_value(value)
click to toggle source
# File lib/pry/commands/ls/formatter.rb, line 37 def format_value(value) Pry::ColorPrinter.pp(value, ''.dup) end
grep()
click to toggle source
# File lib/pry/commands/ls/formatter.rb, line 49 def grep @grep || proc { |x| x } end
output_section(heading, body)
click to toggle source
Add a new section to the output. Outputs nothing if the section would be empty.
# File lib/pry/commands/ls/formatter.rb, line 30 def output_section(heading, body) return '' if body.compact.empty? fancy_heading = Pry::Helpers::Text.bold(color(:heading, heading)) Pry::Helpers.tablify_or_one_line(fancy_heading, body, @pry_instance) end
output_self()
click to toggle source
# File lib/pry/commands/ls/formatter.rb, line 45 def output_self raise NotImplementedError end