Class: SyntaxTree::RBS::MethodSignature::OptionalKeyword

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, param) ⇒ OptionalKeyword

Returns a new instance of OptionalKeyword.



273
274
275
276
# File 'lib/syntax_tree/rbs/utils.rb', line 273

def initialize(name, param)
  @name = name
  @param = param
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



271
272
273
# File 'lib/syntax_tree/rbs/utils.rb', line 271

def name
  @name
end

#paramObject (readonly)

Returns the value of attribute param.



271
272
273
# File 'lib/syntax_tree/rbs/utils.rb', line 271

def param
  @param
end

Instance Method Details

#format(q) ⇒ Object



278
279
280
281
282
283
# File 'lib/syntax_tree/rbs/utils.rb', line 278

def format(q)
  q.text("?")
  q.text(name)
  q.text(": ")
  param.format(q)
end