Class: Eskimo::Components::Indent

Inherits:
Eskimo::Component show all
Defined in:
lib/eskimo/components.rb

Overview

Indent text from the left.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(width: 4, &children) ⇒ Indent

Returns a new instance of Indent.



11
12
13
14
# File 'lib/eskimo/components.rb', line 11

def initialize(width: 4, &children)
  @width = width
  super(&children)
end

Instance Attribute Details

#widthObject (readonly)

Returns the value of attribute width.



9
10
11
# File 'lib/eskimo/components.rb', line 9

def width
  @width
end

Instance Method Details

#renderObject



16
17
18
# File 'lib/eskimo/components.rb', line 16

def render(**)
  Strings.pad(super, [0,0,0,width]).rstrip
end