Class: RBI::KwArg

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

Instance Attribute Summary collapse

Attributes inherited from Arg

#value

Attributes inherited from Node

#loc, #parent_tree

Instance Method Summary collapse

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(keyword, value, loc: nil) ⇒ KwArg

Returns a new instance of KwArg.



1001
1002
1003
1004
# File 'lib/rbi/model.rb', line 1001

def initialize(keyword, value, loc: nil)
  super(value, loc: loc)
  @keyword = keyword
end

Instance Attribute Details

#keywordObject (readonly)

Returns the value of attribute keyword.



992
993
994
# File 'lib/rbi/model.rb', line 992

def keyword
  @keyword
end

Instance Method Details

#==(other) ⇒ Object



1007
1008
1009
# File 'lib/rbi/model.rb', line 1007

def ==(other)
  KwArg === other && value == other.value && keyword == other.keyword
end

#accept_printer(v) ⇒ Object



592
593
594
595
596
# File 'lib/rbi/printer.rb', line 592

def accept_printer(v)
  v.print(keyword)
  v.print(": ")
  v.print(value)
end

#to_sObject



1012
1013
1014
# File 'lib/rbi/model.rb', line 1012

def to_s
  "#{keyword}: #{value}"
end