Class: RBI::Param Abstract
- Inherits:
-
NodeWithComments
- Object
- Node
- NodeWithComments
- RBI::Param
- Defined in:
- lib/rbi/model.rb
Overview
This class is abstract.
Direct Known Subclasses
BlockParam, KwOptParam, KwParam, KwRestParam, OptParam, ReqParam, RestParam
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
: String.
Attributes inherited from NodeWithComments
Attributes inherited from Node
Instance Method Summary collapse
-
#==(other) ⇒ Object
: (Object? other) -> bool.
-
#anonymous? ⇒ Boolean
: -> bool.
-
#initialize(name, loc: nil, comments: nil) ⇒ Param
constructor
: (String name, ?loc: Loc?, ?comments: Array?) -> void.
-
#to_s ⇒ Object
: -> String.
Methods inherited from NodeWithComments
#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, loc: nil, comments: nil) ⇒ Param
: (String name, ?loc: Loc?, ?comments: Array?) -> void
606 607 608 609 610 |
# File 'lib/rbi/model.rb', line 606 def initialize(name, loc: nil, comments: nil) super(loc: loc, comments: comments) @name = name.to_s #: String @anonymous = name.start_with?("_") #: bool end |
Instance Attribute Details
#name ⇒ Object (readonly)
: String
603 604 605 |
# File 'lib/rbi/model.rb', line 603 def name @name end |
Instance Method Details
#==(other) ⇒ Object
: (Object? other) -> bool
624 625 626 627 |
# File 'lib/rbi/model.rb', line 624 def ==(other) self.class === other && (name == other.name || anonymous? || other.anonymous?) end |
#anonymous? ⇒ Boolean
: -> bool
619 620 621 |
# File 'lib/rbi/model.rb', line 619 def anonymous? @anonymous end |
#to_s ⇒ Object
: -> String
614 615 616 |
# File 'lib/rbi/model.rb', line 614 def to_s name end |