Class: MarshalParser::Formatters::AST::Renderers::Renderer

Inherits:
Object
  • Object
show all
Defined in:
lib/marshal-parser/formatters/ast/renderers/renderer.rb

Instance Method Summary collapse

Constructor Details

#initialize(indent_size:) ⇒ Renderer

Returns a new instance of Renderer.



8
9
10
# File 'lib/marshal-parser/formatters/ast/renderers/renderer.rb', line 8

def initialize(indent_size:)
  @indent_size = indent_size
end

Instance Method Details

#render(block) ⇒ Object



12
13
14
15
16
# File 'lib/marshal-parser/formatters/ast/renderers/renderer.rb', line 12

def render(block)
  lines = apply_indentation(block, 0)
  strings = lines.map(&:string)
  strings.join("\n")
end