Class: RBS::Types::Union

Inherits:
Object
  • Object
show all
Defined in:
lib/syntax_tree/rbs/types.rb

Instance Method Summary collapse

Instance Method Details

#format(q) ⇒ Object



258
259
260
261
262
263
264
265
266
267
268
# File 'lib/syntax_tree/rbs/types.rb', line 258

def format(q)
  separator =
    lambda do
      q.breakable
      q.text("| ")
    end

  q.text("(") if q.force_parens?
  q.group { q.seplist(types, separator) { |type| type.format(q) } }
  q.text(")") if q.force_parens?
end

#pretty_print(q) ⇒ Object



270
271
272
273
274
275
276
# File 'lib/syntax_tree/rbs/types.rb', line 270

def pretty_print(q)
  q.group(2, "(union", ")") do
    q.breakable
    q.text("types=")
    q.pp(types)
  end
end