Class: TTY::Box::Border Private
- Inherits:
-
Object
- Object
- TTY::Box::Border
- Defined in:
- lib/tty/box/border.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 reponsible for retrieving border options
Constant Summary collapse
- BORDER_VALUES =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
%i[ corner_bottom_right corner_top_right corner_top_left corner_bottom_left divider_left divider_up divider_down divider_right line pipe cross ].freeze
Instance Attribute Summary collapse
- #bottom ⇒ Object (also: #bottom?) readonly private
- #bottom_left ⇒ Object (also: #bottom_left?) readonly private
- #bottom_right ⇒ Object (also: #bottom_right?) readonly private
- #left ⇒ Object (also: #left?) readonly private
- #right ⇒ Object (also: #right?) readonly private
- #top ⇒ Object (also: #top?) readonly private
- #top_left ⇒ Object (also: #top_left?) readonly private
- #top_right ⇒ Object (also: #top_right?) readonly private
- #type ⇒ Object readonly private
Class Method Summary collapse
- .parse(border) ⇒ Object private
Instance Method Summary collapse
-
#initialize(type: :light, top: :line, top_left: :corner_top_left, top_right: :corner_top_right, left: :pipe, right: :pipe, bottom: :line, bottom_left: :corner_bottom_left, bottom_right: :corner_bottom_right) ⇒ Border
constructor
private
A new instance of Border.
Constructor Details
#initialize(type: :light, top: :line, top_left: :corner_top_left, top_right: :corner_top_right, left: :pipe, right: :pipe, bottom: :line, bottom_left: :corner_bottom_left, bottom_right: :corner_bottom_right) ⇒ Border
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.
Returns a new instance of Border.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/tty/box/border.rb', line 47 def initialize(type: :light, top: :line, top_left: :corner_top_left, top_right: :corner_top_right, left: :pipe, right: :pipe, bottom: :line, bottom_left: :corner_bottom_left, bottom_right: :corner_bottom_right) @type = type @top = check_name(:top, top) @top_left = check_name(:top_left, top_left) @top_right = check_name(:top_right, top_right) @left = check_name(:left, left) @right = check_name(:right, right) @bottom = check_name(:bottom, bottom) @bottom_left = check_name(:bottom_left, bottom_left) @bottom_right = check_name(:bottom_right, bottom_right) end |
Instance Attribute Details
#bottom ⇒ Object (readonly) Also known as: bottom?
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.
35 36 37 |
# File 'lib/tty/box/border.rb', line 35 def bottom @bottom end |
#bottom_left ⇒ Object (readonly) Also known as: bottom_left?
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.
35 36 37 |
# File 'lib/tty/box/border.rb', line 35 def bottom_left @bottom_left end |
#bottom_right ⇒ Object (readonly) Also known as: bottom_right?
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.
35 36 37 |
# File 'lib/tty/box/border.rb', line 35 def bottom_right @bottom_right end |
#left ⇒ Object (readonly) Also known as: left?
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.
35 36 37 |
# File 'lib/tty/box/border.rb', line 35 def left @left end |
#right ⇒ Object (readonly) Also known as: right?
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.
35 36 37 |
# File 'lib/tty/box/border.rb', line 35 def right @right end |
#top ⇒ Object (readonly) Also known as: top?
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.
35 36 37 |
# File 'lib/tty/box/border.rb', line 35 def top @top end |
#top_left ⇒ Object (readonly) Also known as: top_left?
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.
35 36 37 |
# File 'lib/tty/box/border.rb', line 35 def top_left @top_left end |
#top_right ⇒ Object (readonly) Also known as: top_right?
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.
35 36 37 |
# File 'lib/tty/box/border.rb', line 35 def top_right @top_right end |
#type ⇒ Object (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.
35 36 37 |
# File 'lib/tty/box/border.rb', line 35 def type @type end |
Class Method Details
.parse(border) ⇒ Object
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.
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/tty/box/border.rb', line 23 def self.parse(border) case border when Hash new(**border) when *TTY::Box::BOX_CHARS.keys new(type: border) else raise ArgumentError, "Wrong value `#{border}` for :border configuration option" end end |