class Chamomile::Layout::Text
Public Class Methods
Source
# File lib/chamomile/layout/text.rb, line 6 def initialize(content, bold: false, italic: false, color: nil, dim: false, width: nil, align: :left) @content = content.to_s @bold = bold @italic = italic @color = color @dim = dim @width = width @align = align end
Public Instance Methods
Source
# File lib/chamomile/layout/text.rb, line 17 def render(width:, height:) style = Chamomile::Style.new style = style.bold if @bold style = style.italic if @italic style = style.faint if @dim style = style.foreground(@color) if @color style = style.width(@width || width) style = style.align_horizontal(@align) style.render(@content) end