Class: RBI::SigParam
Instance Attribute Summary collapse
#comments
Attributes inherited from Node
#loc, #parent_tree
Instance Method Summary
collapse
#annotations, #comments?, #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: nil, &block) ⇒ SigParam
Returns a new instance of SigParam.
1139
1140
1141
1142
1143
1144
1145
|
# File 'lib/rbi/model.rb', line 1139
def initialize(name, type, loc: nil, comments: nil, &block)
super(loc: loc, comments: )
@name = name.to_s @anonymous = name == "*" || name == "**" || name == "&" @type = type
block&.call(self)
end
|
Instance Attribute Details
#name ⇒ Object
1133
1134
1135
|
# File 'lib/rbi/model.rb', line 1133
def name
@name
end
|
#type ⇒ Object
1136
1137
1138
|
# File 'lib/rbi/model.rb', line 1136
def type
@type
end
|
Instance Method Details
#==(other) ⇒ Object
1159
1160
1161
1162
1163
|
# File 'lib/rbi/model.rb', line 1159
def ==(other)
other.is_a?(SigParam) &&
(name == other.name || anonymous? || other.anonymous?) &&
type.to_s == other.type.to_s
end
|
#anonymous? ⇒ Boolean
1154
1155
1156
|
# File 'lib/rbi/model.rb', line 1154
def anonymous?
@anonymous
end
|
#to_s ⇒ Object
1149
1150
1151
|
# File 'lib/rbi/model.rb', line 1149
def to_s
name
end
|