class Pry::Command::Ls::Formatter
Attributes
_pry_[R]
grep[W]
Public Class Methods
new(_pry_)
click to toggle source
# File lib/pry/commands/ls/formatter.rb, line 7 def initialize(_pry_) @_pry_ = _pry_ @target = _pry_.current_context end
Public Instance Methods
write_out()
click to toggle source
# File lib/pry/commands/ls/formatter.rb, line 12 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 19 def color(type, str) Pry::Helpers::Text.send _pry_.config.ls["#{type}_color"], str end
correct_opts?()
click to toggle source
# File lib/pry/commands/ls/formatter.rb, line 35 def correct_opts? @default_switch end
format_value(value)
click to toggle source
# File lib/pry/commands/ls/formatter.rb, line 31 def format_value(value) Pry::ColorPrinter.pp(value, '') end
grep()
click to toggle source
# File lib/pry/commands/ls/formatter.rb, line 43 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 25 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) end
output_self()
click to toggle source
# File lib/pry/commands/ls/formatter.rb, line 39 def output_self raise NotImplementedError end