Class: TTY::Table::BorderOptions Private
- Inherits:
-
Object
- Object
- TTY::Table::BorderOptions
- Defined in:
- lib/tty/table/border_options.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 that represents table border options
Used internally by Border to manage options such as style
Instance Attribute Summary collapse
- #characters ⇒ Object private
- #separator ⇒ Object private
- #style ⇒ Object private
Class Method Summary collapse
-
.from(options) ⇒ Object
Create options instance from hash.
Instance Method Summary collapse
-
#initialize(characters: {}, separator: nil, style: nil) ⇒ BorderOptions
constructor
Initialize a BorderOptions.
-
#separator?(line) ⇒ Boolean
Check if there should be a separator AFTER this line.
-
#to_hash ⇒ Hash
Convert to hash.
Constructor Details
#initialize(characters: {}, separator: nil, style: nil) ⇒ BorderOptions
Initialize a BorderOptions
42 43 44 45 46 |
# File 'lib/tty/table/border_options.rb', line 42 def initialize(characters: {}, separator: nil, style: nil) @characters = characters @separator = separator @style = style end |
Instance Attribute Details
#characters ⇒ 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.
26 27 28 |
# File 'lib/tty/table/border_options.rb', line 26 def characters @characters end |
#separator ⇒ 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.
28 29 30 |
# File 'lib/tty/table/border_options.rb', line 28 def separator @separator end |
#style ⇒ 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.
30 31 32 |
# File 'lib/tty/table/border_options.rb', line 30 def style @style end |
Class Method Details
.from(options) ⇒ Object
Create options instance from hash
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/tty/table/border_options.rb', line 14 def self.from() return new if .nil? opts = case when self.class .to_hash else end new(**opts) end |
Instance Method Details
#separator?(line) ⇒ Boolean
Check if there should be a separator AFTER this line
64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/tty/table/border_options.rb', line 64 def separator?(line) case separator when TTY::Table::Border::EACH_ROW true when Array separator.include?(line) when Proc separator.call(line) else false end end |
#to_hash ⇒ Hash
Convert to hash
53 54 55 |
# File 'lib/tty/table/border_options.rb', line 53 def to_hash { characters: characters, separator: separator, style: style } end |