Method: TerminalLayout::RenderObject#initialize

Defined in:
lib/terminal_layout.rb

#initialize(box, parent:, content: nil, style: {x:nil, y:nil}, renderer: nil) ⇒ RenderObject

Returns a new instance of RenderObject.



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/terminal_layout.rb', line 16

def initialize(box, parent:, content:nil, style:{x:nil, y:nil}, renderer:nil)
  @box = box
  @content = ANSIString.new(content)
  @children = []
  @parent = parent
  @renderer = renderer
  @style = style
  style[:x] || style[:x] = 0
  style[:y] || style[:y] = 0

  @box.update_computed(style)
end