Class: RBI::SigParam

Inherits:
NodeWithComments show all
Extended by:
T::Sig
Defined in:
lib/rbi/model.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

#annotations, #merge_with, #version_requirements

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(name, type, loc: nil, comments: [], &block) ⇒ SigParam

Returns a new instance of SigParam.



1203
1204
1205
1206
1207
1208
# File 'lib/rbi/model.rb', line 1203

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

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



1189
1190
1191
# File 'lib/rbi/model.rb', line 1189

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



1192
1193
1194
# File 'lib/rbi/model.rb', line 1192

def type
  @type
end

Instance Method Details

#==(other) ⇒ Object



1211
1212
1213
# File 'lib/rbi/model.rb', line 1211

def ==(other)
  other.is_a?(SigParam) && name == other.name && type.to_s == other.type.to_s
end