Sha256: aef81ff37694bccfa655aa5b179abd42586466f356c76ab5d61aef5d44535aa6
Contents?: true
Size: 974 Bytes
Versions: 1
Compression:
Stored size: 974 Bytes
Contents
# encoding: utf-8 # frozen_string_literal: true module TTY class Table # A module responsible for indenting table representation module Indentation # Return a table part with indentation inserted # # @param [#map, #to_s] part # the rendered table part # # @api public def indent(part, indentation) if part.respond_to?(:to_a) part.map { |line| insert_indentation(line, indentation) } else insert_indentation(part, indentation) end end module_function :indent # Insert indentation into a table renderd line # # @param [#to_a, #to_s] line # the rendered table line # # @api public def insert_indentation(line, indentation) line = line.is_a?(Array) ? line[0] : line line.insert(0, ' ' * indentation) if line end module_function :insert_indentation end # Indentation end # Table end # TTY
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tty-table-0.10.0 | lib/tty/table/indentation.rb |