Class: RBI::Param

Inherits:
NodeWithComments show all
Extended by:
T::Helpers, T::Sig
Defined in:
lib/rbi/model.rb,
lib/rbi/printer.rb

Instance Attribute Summary collapse

Attributes inherited from NodeWithComments

#comments

Attributes inherited from Node

#loc, #parent_tree

Instance Method Summary collapse

Methods inherited from NodeWithComments

#merge_with, #oneline?

Methods inherited from Node

#compatible_with?, #detach, #group_kind, #merge_with, #oneline?, #parent_conflict_tree, #parent_scope, #print, #replace, #string

Constructor Details

#initialize(name, loc: nil, comments: []) ⇒ Param

Returns a new instance of Param.



547
548
549
550
# File 'lib/rbi/model.rb', line 547

def initialize(name, loc: nil, comments: [])
  super(loc: loc, comments: comments)
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



538
539
540
# File 'lib/rbi/model.rb', line 538

def name
  @name
end

Instance Method Details

#accept_printer(v) ⇒ Object



402
403
404
# File 'lib/rbi/printer.rb', line 402

def accept_printer(v)
  v.print(name.to_s)
end


407
408
409
410
411
412
# File 'lib/rbi/printer.rb', line 407

def print_comment_leading_space(v, last:)
  v.printn
  v.printt
  v.print(" " * (name.size + 1))
  v.print(" ") unless last
end

#to_sObject



553
554
555
# File 'lib/rbi/model.rb', line 553

def to_s
  name
end