Class: RBI::Helper
- Inherits:
-
NodeWithComments
- Object
- Node
- NodeWithComments
- RBI::Helper
- Includes:
- Indexable
- Defined in:
- lib/rbi/model.rb,
lib/rbi/index.rb,
lib/rbi/rewriters/merge_trees.rb
Overview
Sorbet’s misc.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
: String.
Attributes inherited from NodeWithComments
Attributes inherited from Node
Instance Method Summary collapse
-
#compatible_with?(other) ⇒ Boolean
: (Node other) -> bool.
-
#index_ids ⇒ Object
: -> Array.
-
#initialize(name, loc: nil, comments: [], &block) ⇒ Helper
constructor
: (String name, ?loc: Loc?, ?comments: Array) ?{ (Helper node) -> void } -> void.
-
#to_s ⇒ Object
: -> String.
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, loc: nil, comments: [], &block) ⇒ Helper
: (String name, ?loc: Loc?, ?comments: Array) ?{ (Helper node) -> void } -> void
1047 1048 1049 1050 1051 |
# File 'lib/rbi/model.rb', line 1047 def initialize(name, loc: nil, comments: [], &block) super(loc: loc, comments: comments) @name = name block&.call(self) end |
Instance Attribute Details
#name ⇒ Object (readonly)
: String
1044 1045 1046 |
# File 'lib/rbi/model.rb', line 1044 def name @name end |
Instance Method Details
#compatible_with?(other) ⇒ Boolean
: (Node other) -> bool
495 496 497 |
# File 'lib/rbi/rewriters/merge_trees.rb', line 495 def compatible_with?(other) other.is_a?(Helper) && name == other.name end |
#index_ids ⇒ Object
: -> Array
169 170 171 |
# File 'lib/rbi/index.rb', line 169 def index_ids [to_s] end |
#to_s ⇒ Object
: -> String
1055 1056 1057 |
# File 'lib/rbi/model.rb', line 1055 def to_s "#{parent_scope&.fully_qualified_name}.#{name}!" end |