Method: SyntaxTree::Formatter#group

Defined in:
lib/syntax_tree/formatter.rb

#groupObject

This is a simplified version of prettyprint’s group. It doesn’t provide any of the more advanced options because we don’t need them and they take up expensive computation time.



173
174
175
176
177
178
179
180
181
182
183
# File 'lib/syntax_tree/formatter.rb', line 173

def group
  contents = []
  doc = Group.new(0, contents: contents)

  groups << doc
  target << doc

  with_target(contents) { yield }
  groups.pop
  doc
end