Class: Thaum::Text
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
Attributes included from Sigil
#handler_parent, #rect, #thaum_app
Instance Method Summary collapse
- #focusable? ⇒ Boolean
-
#initialize(content:, align: :left, wrap: :none) ⇒ Text
constructor
A new instance of Text.
- #render(canvas:, theme:) ⇒ Object
Methods included from Sigil
#emit, #focused?, #on_blur, #on_focus, #on_key, #on_mount, #on_mouse, #on_paste, #on_tick, #on_unmount, #on_update, #request_render
Constructor Details
#initialize(content:, align: :left, wrap: :none) ⇒ Text
Returns a new instance of Text.
9 10 11 12 13 |
# File 'lib/thaum/sigils/text.rb', line 9 def initialize(content:, align: :left, wrap: :none) @content = content @align = align @wrap = wrap end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
7 8 9 |
# File 'lib/thaum/sigils/text.rb', line 7 def content @content end |
Instance Method Details
#focusable? ⇒ Boolean
15 |
# File 'lib/thaum/sigils/text.rb', line 15 def focusable? = false |
#render(canvas:, theme:) ⇒ Object
17 18 19 20 |
# File 'lib/thaum/sigils/text.rb', line 17 def render(canvas:, theme:) resolved = content.respond_to?(:call) ? content.call : content canvas.text(content: resolved.to_s, fg: theme.fg, align: @align, wrap: @wrap) end |