Class: Charming::UI::Border

Inherits:
Object
  • Object
show all
Defined in:
lib/charming/ui/border.rb

Constant Summary collapse

STYLES =
{
  normal: Border.new(
    corners: ["+", "+", "+", "+"], edges: ["-", "|"]
  ),
  rounded: Border.new(
    corners: ["", "", "", ""], edges: ["", ""]
  ),
  thick: Border.new(
    corners: ["", "", "", ""], edges: ["", ""]
  ),
  double: Border.new(
    corners: ["", "", "", ""], edges: ["", ""]
  )
}.freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(corners:, edges:) ⇒ Border

Returns a new instance of Border.



8
9
10
11
# File 'lib/charming/ui/border.rb', line 8

def initialize(corners:, edges:)
  @top_left, @top_right, @bottom_left, @bottom_right = corners
  @horizontal, @vertical = edges
end

Instance Attribute Details

#bottom_leftObject (readonly)

Returns the value of attribute bottom_left.



6
7
8
# File 'lib/charming/ui/border.rb', line 6

def bottom_left
  @bottom_left
end

#bottom_rightObject (readonly)

Returns the value of attribute bottom_right.



6
7
8
# File 'lib/charming/ui/border.rb', line 6

def bottom_right
  @bottom_right
end

#horizontalObject (readonly)

Returns the value of attribute horizontal.



6
7
8
# File 'lib/charming/ui/border.rb', line 6

def horizontal
  @horizontal
end

#top_leftObject (readonly)

Returns the value of attribute top_left.



6
7
8
# File 'lib/charming/ui/border.rb', line 6

def top_left
  @top_left
end

#top_rightObject (readonly)

Returns the value of attribute top_right.



6
7
8
# File 'lib/charming/ui/border.rb', line 6

def top_right
  @top_right
end

#verticalObject (readonly)

Returns the value of attribute vertical.



6
7
8
# File 'lib/charming/ui/border.rb', line 6

def vertical
  @vertical
end

Class Method Details

.fetch(name) ⇒ Object



13
14
15
# File 'lib/charming/ui/border.rb', line 13

def self.fetch(name)
  STYLES.fetch(name.to_sym)
end