Class: RBI::KwArg

Inherits:
Arg show all
Defined in:
lib/rbi/model.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, #merge_with, #parent_conflict_tree, #parent_scope, #print, #rbs_print, #rbs_string, #replace, #satisfies_version?, #string

Constructor Details

#initialize(keyword, value, loc: nil) ⇒ KwArg

Returns a new instance of KwArg.

Signature:

  • (String keyword, String value, ?loc: Loc?) -> void



1037
1038
1039
1040
# File 'lib/rbi/model.rb', line 1037

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

Instance Attribute Details

#keywordObject (readonly)

Signature:

  • String



1034
1035
1036
# File 'lib/rbi/model.rb', line 1034

def keyword
  @keyword
end

Instance Method Details

#==(other) ⇒ Object

Signature:

  • (Object? other) -> bool



1043
1044
1045
# File 'lib/rbi/model.rb', line 1043

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

#to_sObject

Signature:

  • -> String



1048
1049
1050
# File 'lib/rbi/model.rb', line 1048

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