Class: TTY::Table::BorderDSL Private
- Inherits:
-
Object
- Object
- TTY::Table::BorderDSL
- 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
Instance Attribute Summary collapse
-
#options ⇒ Table::BorderOptions
readonly
private
Border options.
Instance Method Summary collapse
-
#bottom(value) ⇒ undefined
Set bottom border character.
-
#bottom_left(value) ⇒ undefined
Set bottom left corner border character.
-
#bottom_mid(value) ⇒ undefined
Set bottom middle border character.
-
#bottom_right(value) ⇒ undefined
Set bottom right corner border character.
-
#center(value) ⇒ undefined
Set center border character.
-
#initialize(characters = nil, &block) ⇒ undefined
constructor
private
Initialize a BorderDSL.
-
#left(value) ⇒ undefined
Set left border character.
-
#mid(value) ⇒ undefined
Set middle border character.
-
#mid_left(value) ⇒ undefined
Set middle left corner border character.
-
#mid_mid(value) ⇒ undefined
Set middle border character.
-
#mid_right(value) ⇒ undefined
Set middle right corner border character.
-
#right(value) ⇒ undefined
Set right border character.
-
#separator(value) ⇒ undefined
Apply table tuple separator.
-
#style(value) ⇒ undefined
Apply style color to the border.
-
#top(value) ⇒ undefined
Set top border character.
-
#top_left(value) ⇒ undefined
Set top left corner border character.
-
#top_mid(value) ⇒ undefined
Set top middle border character.
-
#top_right(value) ⇒ undefined
Set top right corner border character.
Methods included from Delegatable
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
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
#options ⇒ Table::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
16 17 18 |
# File 'lib/tty/table/border_dsl.rb', line 16 def @options end |
Instance Method Details
#bottom(value) ⇒ undefined
Set bottom border character
114 115 116 |
# File 'lib/tty/table/border_dsl.rb', line 114 def bottom(value) .characters['bottom'] = value end |
#bottom_left(value) ⇒ undefined
Set bottom left corner border character
138 139 140 |
# File 'lib/tty/table/border_dsl.rb', line 138 def bottom_left(value) .characters['bottom_left'] = value end |
#bottom_mid(value) ⇒ undefined
Set bottom middle border character
126 127 128 |
# File 'lib/tty/table/border_dsl.rb', line 126 def bottom_mid(value) .characters['bottom_mid'] = value end |
#bottom_right(value) ⇒ undefined
Set bottom right corner border character
150 151 152 |
# File 'lib/tty/table/border_dsl.rb', line 150 def bottom_right(value) .characters['bottom_right'] = value end |
#center(value) ⇒ undefined
Set center border character
222 223 224 |
# File 'lib/tty/table/border_dsl.rb', line 222 def center(value) .characters['center'] = value end |
#left(value) ⇒ undefined
Set left border character
210 211 212 |
# File 'lib/tty/table/border_dsl.rb', line 210 def left(value) .characters['left'] = value end |
#mid(value) ⇒ undefined
Set middle border character
162 163 164 |
# File 'lib/tty/table/border_dsl.rb', line 162 def mid(value) .characters['mid'] = value end |
#mid_left(value) ⇒ undefined
Set middle left corner border character
186 187 188 |
# File 'lib/tty/table/border_dsl.rb', line 186 def mid_left(value) .characters['mid_left'] = value end |
#mid_mid(value) ⇒ undefined
Set middle border character
174 175 176 |
# File 'lib/tty/table/border_dsl.rb', line 174 def mid_mid(value) .characters['mid_mid'] = value end |
#mid_right(value) ⇒ undefined
Set middle right corner border character
198 199 200 |
# File 'lib/tty/table/border_dsl.rb', line 198 def mid_right(value) .characters['mid_right'] = value end |
#right(value) ⇒ undefined
Set right border character
234 235 236 |
# File 'lib/tty/table/border_dsl.rb', line 234 def right(value) .characters['right'] = value end |
#separator(value) ⇒ undefined
Apply table tuple separator
54 55 56 |
# File 'lib/tty/table/border_dsl.rb', line 54 def separator(value) value ? .separator = value : .separator end |
#style(value) ⇒ undefined
Apply style color to the border
42 43 44 |
# File 'lib/tty/table/border_dsl.rb', line 42 def style(value) .style = value end |
#top(value) ⇒ undefined
Set top border character
66 67 68 |
# File 'lib/tty/table/border_dsl.rb', line 66 def top(value) .characters['top'] = value end |
#top_left(value) ⇒ undefined
Set top left corner border character
90 91 92 |
# File 'lib/tty/table/border_dsl.rb', line 90 def top_left(value) .characters['top_left'] = value end |
#top_mid(value) ⇒ undefined
Set top middle border character
78 79 80 |
# File 'lib/tty/table/border_dsl.rb', line 78 def top_mid(value) .characters['top_mid'] = value end |
#top_right(value) ⇒ undefined
Set top right corner border character
102 103 104 |
# File 'lib/tty/table/border_dsl.rb', line 102 def top_right(value) .characters['top_right'] = value end |