Class: Terminal::Table::Border

Inherits:
Object
  • Object
show all
Defined in:
lib/terminal-table/style.rb

Direct Known Subclasses

AsciiBorder, UnicodeBorder

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBorder

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

#bottomObject

Returns the value of attribute bottom.



9
10
11
# File 'lib/terminal-table/style.rb', line 9

def bottom
  @bottom
end

#dataObject

Returns the value of attribute data.



9
10
11
# File 'lib/terminal-table/style.rb', line 9

def data
  @data
end

#leftObject

Returns the value of attribute left.



9
10
11
# File 'lib/terminal-table/style.rb', line 9

def left
  @left
end

#rightObject

Returns the value of attribute right.



9
10
11
# File 'lib/terminal-table/style.rb', line 9

def right
  @right
end

#topObject

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_horizontalsObject



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_verticalsObject



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