Class: Terminal::Table::Border
- Inherits:
-
Object
- Object
- Terminal::Table::Border
- Defined in:
- lib/terminal-table/style.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#bottom ⇒ Object
Returns the value of attribute bottom.
-
#data ⇒ Object
Returns the value of attribute data.
-
#left ⇒ Object
Returns the value of attribute left.
-
#right ⇒ Object
Returns the value of attribute right.
-
#top ⇒ Object
Returns the value of attribute top.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, val) ⇒ Object
-
#initialize ⇒ Border
constructor
A new instance of Border.
- #initialize_dup(other) ⇒ Object
-
#maybeleft(key) ⇒ Object
If @left, return the edge else empty-string.
-
#mayberight(key) ⇒ Object
If @right, return the edge else empty-string.
- #remove_horizontals ⇒ Object
- #remove_verticals ⇒ Object
Constructor Details
#initialize ⇒ Border
Returns a new instance of Border.
10 11 12 |
# File 'lib/terminal-table/style.rb', line 10 def initialize @top, @bottom, @left, @right = true, true, true, true end |
Instance Attribute Details
#bottom ⇒ Object
Returns the value of attribute bottom.
9 10 11 |
# File 'lib/terminal-table/style.rb', line 9 def bottom @bottom end |
#data ⇒ Object
Returns the value of attribute data.
9 10 11 |
# File 'lib/terminal-table/style.rb', line 9 def data @data end |
#left ⇒ Object
Returns the value of attribute left.
9 10 11 |
# File 'lib/terminal-table/style.rb', line 9 def left @left end |
#right ⇒ Object
Returns the value of attribute right.
9 10 11 |
# File 'lib/terminal-table/style.rb', line 9 def right @right end |
#top ⇒ Object
Returns the value of attribute top.
9 10 11 |
# File 'lib/terminal-table/style.rb', line 9 def top @top end |
Instance Method Details
#[](key) ⇒ Object
16 17 18 |
# File 'lib/terminal-table/style.rb', line 16 def [](key) @data[key] end |
#[]=(key, val) ⇒ Object
13 14 15 |
# File 'lib/terminal-table/style.rb', line 13 def []=(key, val) @data[key] = val end |
#initialize_dup(other) ⇒ Object
19 20 21 22 |
# File 'lib/terminal-table/style.rb', line 19 def initialize_dup(other) super @data = other.data.dup end |
#maybeleft(key) ⇒ Object
If @left, return the edge else empty-string.
32 |
# File 'lib/terminal-table/style.rb', line 32 def maybeleft(key) ; @left ? @data[key] : '' ; end |
#mayberight(key) ⇒ Object
If @right, return the edge else empty-string.
35 |
# File 'lib/terminal-table/style.rb', line 35 def mayberight(key) ; @right ? @data[key] : '' ; end |
#remove_horizontals ⇒ Object
27 28 29 |
# File 'lib/terminal-table/style.rb', line 27 def remove_horizontals self.class.const_get("HORIZONTALS").each { |key| @data[key] = "" } end |
#remove_verticals ⇒ Object
23 24 25 26 |
# File 'lib/terminal-table/style.rb', line 23 def remove_verticals self.class.const_get("VERTICALS").each { |key| @data[key] = "" } self.class.const_get("INTERSECTIONS").each { |key| @data[key] = "" } end |