Class: TTY::Table::BorderDSL
- Inherits:
-
Object
- Object
- TTY::Table::BorderDSL
- Extended by:
- Delegatable
- Defined in:
- lib/tty/table/border_dsl.rb
Overview
A class responsible for bulding and modifying border
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute 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
22 23 24 25 26 |
# File 'lib/tty/table/border_dsl.rb', line 22 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 ⇒ Object (readonly)
Returns the value of attribute options.
10 11 12 |
# File 'lib/tty/table/border_dsl.rb', line 10 def @options end |
Instance Method Details
#bottom(value) ⇒ undefined
Set bottom border character
108 109 110 |
# File 'lib/tty/table/border_dsl.rb', line 108 def bottom(value) .characters['bottom'] = value end |
#bottom_left(value) ⇒ undefined
Set bottom left corner border character
132 133 134 |
# File 'lib/tty/table/border_dsl.rb', line 132 def bottom_left(value) .characters['bottom_left'] = value end |
#bottom_mid(value) ⇒ undefined
Set bottom middle border character
120 121 122 |
# File 'lib/tty/table/border_dsl.rb', line 120 def bottom_mid(value) .characters['bottom_mid'] = value end |
#bottom_right(value) ⇒ undefined
Set bottom right corner border character
144 145 146 |
# File 'lib/tty/table/border_dsl.rb', line 144 def bottom_right(value) .characters['bottom_right'] = value end |
#center(value) ⇒ undefined
Set center border character
216 217 218 |
# File 'lib/tty/table/border_dsl.rb', line 216 def center(value) .characters['center'] = value end |
#left(value) ⇒ undefined
Set left border character
204 205 206 |
# File 'lib/tty/table/border_dsl.rb', line 204 def left(value) .characters['left'] = value end |
#mid(value) ⇒ undefined
Set middle border character
156 157 158 |
# File 'lib/tty/table/border_dsl.rb', line 156 def mid(value) .characters['mid'] = value end |
#mid_left(value) ⇒ undefined
Set middle left corner border character
180 181 182 |
# File 'lib/tty/table/border_dsl.rb', line 180 def mid_left(value) .characters['mid_left'] = value end |
#mid_mid(value) ⇒ undefined
Set middle border character
168 169 170 |
# File 'lib/tty/table/border_dsl.rb', line 168 def mid_mid(value) .characters['mid_mid'] = value end |
#mid_right(value) ⇒ undefined
Set middle right corner border character
192 193 194 |
# File 'lib/tty/table/border_dsl.rb', line 192 def mid_right(value) .characters['mid_right'] = value end |
#right(value) ⇒ undefined
Set right border character
228 229 230 |
# File 'lib/tty/table/border_dsl.rb', line 228 def right(value) .characters['right'] = value end |
#separator(value) ⇒ undefined
Apply table tuple separator
48 49 50 |
# File 'lib/tty/table/border_dsl.rb', line 48 def separator(value) .separator = value end |
#style(value) ⇒ undefined
Apply style color to the border
36 37 38 |
# File 'lib/tty/table/border_dsl.rb', line 36 def style(value) .style = value end |
#top(value) ⇒ undefined
Set top border character
60 61 62 |
# File 'lib/tty/table/border_dsl.rb', line 60 def top(value) .characters['top'] = value end |
#top_left(value) ⇒ undefined
Set top left corner border character
84 85 86 |
# File 'lib/tty/table/border_dsl.rb', line 84 def top_left(value) .characters['top_left'] = value end |
#top_mid(value) ⇒ undefined
Set top middle border character
72 73 74 |
# File 'lib/tty/table/border_dsl.rb', line 72 def top_mid(value) .characters['top_mid'] = value end |
#top_right(value) ⇒ undefined
Set top right corner border character
96 97 98 |
# File 'lib/tty/table/border_dsl.rb', line 96 def top_right(value) .characters['top_right'] = value end |