Class: RBI::TStructField

Inherits:
NodeWithComments show all
Extended by:
T::Helpers, T::Sig
Defined in:
lib/rbi/model.rb,
lib/rbi/rewriters/merge_trees.rb

Direct Known Subclasses

TStructConst, TStructProp

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

#detach, #merge_with, #parent_conflict_tree, #parent_scope, #print, #replace, #satisfies_version?, #string

Constructor Details

#initialize(name, type, default: nil, loc: nil, comments: []) ⇒ TStructField

Returns a new instance of TStructField.



1246
1247
1248
1249
1250
1251
# File 'lib/rbi/model.rb', line 1246

def initialize(name, type, default: nil, loc: nil, comments: [])
  super(loc: loc, comments: comments)
  @name = name
  @type = type
  @default = default
end

Instance Attribute Details

#defaultObject

Returns the value of attribute default.



1235
1236
1237
# File 'lib/rbi/model.rb', line 1235

def default
  @default
end

#nameObject

Returns the value of attribute name.



1232
1233
1234
# File 'lib/rbi/model.rb', line 1232

def name
  @name
end

#typeObject

Returns the value of attribute type.



1232
1233
1234
# File 'lib/rbi/model.rb', line 1232

def type
  @type
end

Instance Method Details

#compatible_with?(other) ⇒ Boolean

Returns:

  • (Boolean)


540
541
542
# File 'lib/rbi/rewriters/merge_trees.rb', line 540

def compatible_with?(other)
  other.is_a?(TStructField) && name == other.name && type == other.type && default == other.default
end

#fully_qualified_namesObject



1254
# File 'lib/rbi/model.rb', line 1254

def fully_qualified_names; end