Class: Gm::Notepad::LineRenderer

Inherits:
Object
  • Object
show all
Extended by:
Dry::Initializer
Defined in:
lib/gm/notepad/line_renderer.rb

Overview

Responsible for rendering lines to the corresponding buffers

Instance Method Summary collapse

Instance Method Details

#call(lines, to_output: false, to_interactive: true, as_of: Time.now) ⇒ Object



32
33
34
35
# File 'lib/gm/notepad/line_renderer.rb', line 32

def call(lines, to_output: false, to_interactive: true, as_of: Time.now)
  render_interactive(lines) if to_interactive
  render_output(lines, as_of: as_of) if to_output
end

#close!Object



37
38
39
40
# File 'lib/gm/notepad/line_renderer.rb', line 37

def close!
  interactive_buffer.close!
  output_buffer.close!
end

#render(output:, as_of: Time.now) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/gm/notepad/line_renderer.rb', line 16

def render(output:, as_of: Time.now)
  output.evaluate!
  output.lines_for_rendering.each do |line|
    next unless line.to_interactive
    render_interactive(line)
  end
  output.lines_for_rendering.each do |line|
    next unless line.to_output
    render_output(line, as_of: as_of)
  end
  output.lines_for_rendering.each do |line|
    next unless line.to_filesystem
    render_filesystem(line)
  end
end