Class: Charming::Presentation::UI::Border

Inherits:
Object
  • Object
show all
Defined in:
lib/charming/presentation/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.



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

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.



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

def bottom_left
  @bottom_left
end

#bottom_rightObject (readonly)

Returns the value of attribute bottom_right.



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

def bottom_right
  @bottom_right
end

#horizontalObject (readonly)

Returns the value of attribute horizontal.



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

def horizontal
  @horizontal
end

#top_leftObject (readonly)

Returns the value of attribute top_left.



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

def top_left
  @top_left
end

#top_rightObject (readonly)

Returns the value of attribute top_right.



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

def top_right
  @top_right
end

#verticalObject (readonly)

Returns the value of attribute vertical.



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

def vertical
  @vertical
end

Class Method Details

.fetch(name) ⇒ Object



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

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