Class: TTY::Table::BorderDSL Private

Inherits:
Object
  • Object
show all
Extended by:
Delegatable
Defined in:
lib/tty/table/border_dsl.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

A class responsible for bulding and modifying border

Used internally by Border to allow for building custom border through DSL

API:

  • private

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Delegatable

delegatable_method

Constructor Details

#initialize(characters = nil, &block) ⇒ undefined

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initialize a BorderDSL

Parameters:

  • (defaults to: nil)

    the border characters

API:

  • private



28
29
30
31
32
# File 'lib/tty/table/border_dsl.rb', line 28

def initialize(characters = nil, &block)
  @options = TTY::Table::BorderOptions.new
  @options.characters = characters if characters
  yield_or_eval(&block) if block_given?
end

Instance Attribute Details

#optionsTable::BorderOptions (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Border options

Returns:

API:

  • private



16
17
18
# File 'lib/tty/table/border_dsl.rb', line 16

def options
  @options
end

Instance Method Details

#bottom(value) ⇒ undefined

Set bottom border character

Parameters:

  • the character value

Returns:

API:

  • public



114
115
116
# File 'lib/tty/table/border_dsl.rb', line 114

def bottom(value)
  options.characters['bottom'] = value
end

#bottom_left(value) ⇒ undefined

Set bottom left corner border character

Parameters:

  • the character value

Returns:

API:

  • public



138
139
140
# File 'lib/tty/table/border_dsl.rb', line 138

def bottom_left(value)
  options.characters['bottom_left'] = value
end

#bottom_mid(value) ⇒ undefined

Set bottom middle border character

Parameters:

  • the character value

Returns:

API:

  • public



126
127
128
# File 'lib/tty/table/border_dsl.rb', line 126

def bottom_mid(value)
  options.characters['bottom_mid'] = value
end

#bottom_right(value) ⇒ undefined

Set bottom right corner border character

Parameters:

  • the character value

Returns:

API:

  • public



150
151
152
# File 'lib/tty/table/border_dsl.rb', line 150

def bottom_right(value)
  options.characters['bottom_right'] = value
end

#center(value) ⇒ undefined

Set center border character

Parameters:

  • the character value

Returns:

API:

  • public



222
223
224
# File 'lib/tty/table/border_dsl.rb', line 222

def center(value)
  options.characters['center'] = value
end

#left(value) ⇒ undefined

Set left border character

Parameters:

  • the character value

Returns:

API:

  • public



210
211
212
# File 'lib/tty/table/border_dsl.rb', line 210

def left(value)
  options.characters['left'] = value
end

#mid(value) ⇒ undefined

Set middle border character

Parameters:

  • the character value

Returns:

API:

  • public



162
163
164
# File 'lib/tty/table/border_dsl.rb', line 162

def mid(value)
  options.characters['mid'] = value
end

#mid_left(value) ⇒ undefined

Set middle left corner border character

Parameters:

  • the character value

Returns:

API:

  • public



186
187
188
# File 'lib/tty/table/border_dsl.rb', line 186

def mid_left(value)
  options.characters['mid_left'] = value
end

#mid_mid(value) ⇒ undefined

Set middle border character

Parameters:

  • the character value

Returns:

API:

  • public



174
175
176
# File 'lib/tty/table/border_dsl.rb', line 174

def mid_mid(value)
  options.characters['mid_mid'] = value
end

#mid_right(value) ⇒ undefined

Set middle right corner border character

Parameters:

  • the character value

Returns:

API:

  • public



198
199
200
# File 'lib/tty/table/border_dsl.rb', line 198

def mid_right(value)
  options.characters['mid_right'] = value
end

#right(value) ⇒ undefined

Set right border character

Parameters:

  • the character value

Returns:

API:

  • public



234
235
236
# File 'lib/tty/table/border_dsl.rb', line 234

def right(value)
  options.characters['right'] = value
end

#separator(value) ⇒ undefined

Apply table tuple separator

Parameters:

  • the table tuple separator

Returns:

API:

  • public



54
55
56
# File 'lib/tty/table/border_dsl.rb', line 54

def separator(value)
  value ? options.separator = value : options.separator
end

#style(value) ⇒ undefined

Apply style color to the border

Parameters:

  • the style color for the border

Returns:

API:

  • public



42
43
44
# File 'lib/tty/table/border_dsl.rb', line 42

def style(value)
  options.style = value
end

#top(value) ⇒ undefined

Set top border character

Parameters:

  • the character value

Returns:

API:

  • public



66
67
68
# File 'lib/tty/table/border_dsl.rb', line 66

def top(value)
  options.characters['top'] = value
end

#top_left(value) ⇒ undefined

Set top left corner border character

Parameters:

  • the character value

Returns:

API:

  • public



90
91
92
# File 'lib/tty/table/border_dsl.rb', line 90

def top_left(value)
  options.characters['top_left'] = value
end

#top_mid(value) ⇒ undefined

Set top middle border character

Parameters:

  • the character value

Returns:

API:

  • public



78
79
80
# File 'lib/tty/table/border_dsl.rb', line 78

def top_mid(value)
  options.characters['top_mid'] = value
end

#top_right(value) ⇒ undefined

Set top right corner border character

Parameters:

  • the character value

Returns:

API:

  • public



102
103
104
# File 'lib/tty/table/border_dsl.rb', line 102

def top_right(value)
  options.characters['top_right'] = value
end