Class: RBS::Types::Optional

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

Instance Method Summary collapse

Instance Method Details

#format(q) ⇒ Object



170
171
172
173
# File 'lib/syntax_tree/rbs/types.rb', line 170

def format(q)
  q.force_parens { type.format(q) }
  q.text("?")
end

#pretty_print(q) ⇒ Object



175
176
177
178
179
180
# File 'lib/syntax_tree/rbs/types.rb', line 175

def pretty_print(q)
  q.group(2, "(optional", ")") do
    q.breakable
    q.pp(type)
  end
end