Class: TTY::Table::BorderDSL Private
- Inherits:
-
Object
- Object
- TTY::Table::BorderDSL
- Extended by:
- Forwardable
- 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(border_opts = 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 = (not_set = true)) ⇒ undefined
Apply table tuple separator.
-
#style(value = (not_set = true)) ⇒ 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.
Constructor Details
#initialize(border_opts = 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
32 33 34 35 |
# File 'lib/tty/table/border_dsl.rb', line 32 def initialize(border_opts = nil, &block) @options = TTY::Table::BorderOptions.from(border_opts) 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
20 21 22 |
# File 'lib/tty/table/border_dsl.rb', line 20 def @options end |
Instance Method Details
#bottom(value) ⇒ undefined
Set bottom border character
121 122 123 |
# File 'lib/tty/table/border_dsl.rb', line 121 def bottom(value) characters["bottom"] = value end |
#bottom_left(value) ⇒ undefined
Set bottom left corner border character
145 146 147 |
# File 'lib/tty/table/border_dsl.rb', line 145 def bottom_left(value) characters["bottom_left"] = value end |
#bottom_mid(value) ⇒ undefined
Set bottom middle border character
133 134 135 |
# File 'lib/tty/table/border_dsl.rb', line 133 def bottom_mid(value) characters["bottom_mid"] = value end |
#bottom_right(value) ⇒ undefined
Set bottom right corner border character
157 158 159 |
# File 'lib/tty/table/border_dsl.rb', line 157 def bottom_right(value) characters["bottom_right"] = value end |
#center(value) ⇒ undefined
Set center border character
229 230 231 |
# File 'lib/tty/table/border_dsl.rb', line 229 def center(value) characters["center"] = value end |
#left(value) ⇒ undefined
Set left border character
217 218 219 |
# File 'lib/tty/table/border_dsl.rb', line 217 def left(value) characters["left"] = value end |
#mid(value) ⇒ undefined
Set middle border character
169 170 171 |
# File 'lib/tty/table/border_dsl.rb', line 169 def mid(value) characters["mid"] = value end |
#mid_left(value) ⇒ undefined
Set middle left corner border character
193 194 195 |
# File 'lib/tty/table/border_dsl.rb', line 193 def mid_left(value) characters["mid_left"] = value end |
#mid_mid(value) ⇒ undefined
Set middle border character
181 182 183 |
# File 'lib/tty/table/border_dsl.rb', line 181 def mid_mid(value) characters["mid_mid"] = value end |
#mid_right(value) ⇒ undefined
Set middle right corner border character
205 206 207 |
# File 'lib/tty/table/border_dsl.rb', line 205 def mid_right(value) characters["mid_right"] = value end |
#right(value) ⇒ undefined
Set right border character
241 242 243 |
# File 'lib/tty/table/border_dsl.rb', line 241 def right(value) characters["right"] = value end |
#separator(value = (not_set = true)) ⇒ undefined
Apply table tuple separator
59 60 61 62 63 |
# File 'lib/tty/table/border_dsl.rb', line 59 def separator(value = (not_set = true)) return .separator if not_set .separator = value end |
#style(value = (not_set = true)) ⇒ undefined
Apply style color to the border
45 46 47 48 49 |
# File 'lib/tty/table/border_dsl.rb', line 45 def style(value = (not_set = true)) return .style if not_set .style = value end |
#top(value) ⇒ undefined
Set top border character
73 74 75 |
# File 'lib/tty/table/border_dsl.rb', line 73 def top(value) characters["top"] = value end |
#top_left(value) ⇒ undefined
Set top left corner border character
97 98 99 |
# File 'lib/tty/table/border_dsl.rb', line 97 def top_left(value) characters["top_left"] = value end |
#top_mid(value) ⇒ undefined
Set top middle border character
85 86 87 |
# File 'lib/tty/table/border_dsl.rb', line 85 def top_mid(value) characters["top_mid"] = value end |
#top_right(value) ⇒ undefined
Set top right corner border character
109 110 111 |
# File 'lib/tty/table/border_dsl.rb', line 109 def top_right(value) characters["top_right"] = value end |