Module: Pry::Helpers

Defined in:
lib/pry/helpers/text.rb,
lib/pry/helpers/table.rb,
lib/pry/helpers/base_helpers.rb,
lib/pry/helpers/options_helpers.rb,
lib/pry/helpers/command_helpers.rb,
lib/pry/helpers/documentation_helpers.rb

Defined Under Namespace

Modules: BaseHelpers, CommandHelpers, DocumentationHelpers, OptionsHelpers, Text Classes: Table

Class Method Summary collapse

Class Method Details

.tablify(things, line_length) ⇒ Object



14
15
16
17
18
19
# File 'lib/pry/helpers/table.rb', line 14

def self.tablify(things, line_length)
  table = Table.new(things, :column_count => things.size)
  table.column_count -= 1 until 0 == table.column_count or
    table.fits_on_line?(line_length)
  table
end

.tablify_to_screen_width(things) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/pry/helpers/table.rb', line 3

def self.tablify_to_screen_width(things)
  things = things.compact

  if TerminalInfo.screen_size.nil?
    return things.join(Pry.config.ls.separator)
  end

  screen_width = (TerminalInfo.screen_size || [25, 80])[1]
  tablify(things, screen_width)
end