Class: Grape::Apidoc::TableFormat

Inherits:
Array
  • Object
show all
Defined in:
lib/grape/apidoc/table_format.rb

Overview

column cell widths

Instance Method Summary collapse

Instance Method Details

#format(*values) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/grape/apidoc/table_format.rb', line 3

def format(*values)
  str = '|'

  each_with_index do |width, index|
    str << ' '
    str << (values[index] || '').ljust(width)
    str << ' |'
  end

  str
end

#separatorObject



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/grape/apidoc/table_format.rb', line 15

def separator
  str = '|'

  each_with_index do |width, _index|
    str << ' '
    str << ('-' * width)
    str << ' |'
  end

  str
end