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, #rbs_print, #rbs_string, #replace, #satisfies_version?, #string

Constructor Details

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

: (String name, (Type | String) type, ?default: String?, ?loc: Loc?, ?comments: Array) -> void



959
960
961
962
963
964
# File 'lib/rbi/model.rb', line 959

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

: String?



956
957
958
# File 'lib/rbi/model.rb', line 956

def default
  @default
end

#nameObject

: String



950
951
952
# File 'lib/rbi/model.rb', line 950

def name
  @name
end

#typeObject

: (Type | String)



953
954
955
# File 'lib/rbi/model.rb', line 953

def type
  @type
end

Instance Method Details

#compatible_with?(other) ⇒ Boolean

: (Node other) -> bool



511
512
513
# File 'lib/rbi/rewriters/merge_trees.rb', line 511

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

#fully_qualified_namesObject



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

def fully_qualified_names; end