Class: RBI::KwParam

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

Instance Attribute Summary

Attributes inherited from Param

#name

Attributes inherited from NodeWithComments

#comments

Attributes inherited from Node

#loc, #parent_tree

Instance Method Summary collapse

Methods inherited from Param

#comments_lines

Methods inherited from NodeWithComments

#annotations, #merge_with, #oneline?

Methods inherited from Node

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

Constructor Details

#initialize(name, loc: nil, comments: [], &block) ⇒ KwParam

Returns a new instance of KwParam.



658
659
660
661
# File 'lib/rbi/model.rb', line 658

def initialize(name, loc: nil, comments: [], &block)
  super(name, loc: loc, comments: comments)
  block&.call(self)
end

Instance Method Details

#==(other) ⇒ Object



669
670
671
# File 'lib/rbi/model.rb', line 669

def ==(other)
  KwParam === other && name == other.name
end

#accept_printer(v) ⇒ Object



468
469
470
# File 'lib/rbi/printer.rb', line 468

def accept_printer(v)
  v.print("#{name}:")
end


473
474
475
476
# File 'lib/rbi/printer.rb', line 473

def print_comment_leading_space(v, last:)
  super
  v.print(" ")
end

#to_sObject



664
665
666
# File 'lib/rbi/model.rb', line 664

def to_s
  "#{name}:"
end