Class: TTY::Table::BorderOptions Private
- Inherits:
-
Struct
- Object
- Struct
- 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
Returns the value of attribute characters.
-
#separator ⇒ Object
Returns the value of attribute separator.
-
#style ⇒ Object
Returns the value of attribute style.
Class Method Summary collapse
-
.from(value) ⇒ Object
Create options instance from hash.
Instance Method Summary collapse
-
#initialize(*args) ⇒ BorderOptions
constructor
Initialize a BorderOptions.
-
#to_hash ⇒ Object
Convert to hash.
-
#update(obj) ⇒ BorderOptions
Set all accessors with hash attributes.
Constructor Details
#initialize(*args) ⇒ BorderOptions
Initialize a BorderOptions
14 15 16 17 |
# File 'lib/tty/table/border_options.rb', line 14 def initialize(*args) super(*args) self.characters = {} unless characters end |
Instance Attribute Details
#characters ⇒ Object
Returns the value of attribute characters
10 11 12 |
# File 'lib/tty/table/border_options.rb', line 10 def characters @characters end |
#separator ⇒ Object
Returns the value of attribute separator
10 11 12 |
# File 'lib/tty/table/border_options.rb', line 10 def separator @separator end |
#style ⇒ Object
Returns the value of attribute style
10 11 12 |
# File 'lib/tty/table/border_options.rb', line 10 def style @style end |
Class Method Details
.from(value) ⇒ Object
Create options instance from hash
22 23 24 |
# File 'lib/tty/table/border_options.rb', line 22 def self.from(value) value ? new.update(value) : new end |
Instance Method Details
#to_hash ⇒ Object
Convert to hash
43 44 45 46 47 48 49 50 |
# File 'lib/tty/table/border_options.rb', line 43 def to_hash hash = {} members.each do |key| value = send(key) hash[key.to_sym] = value if value end hash end |
#update(obj) ⇒ BorderOptions
Set all accessors with hash attributes
33 34 35 36 37 38 |
# File 'lib/tty/table/border_options.rb', line 33 def update(obj) obj.each_pair do |key, value| send("#{key}=", value) end self end |