Class: RBS::Inline::AST::Declarations::ModuleOrClass
- Defined in:
- lib/rbs/inline/ast/declarations.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#comments ⇒ Object
readonly
Leading comment.
-
#members ⇒ Object
readonly
Members included in the declaration.
-
#node ⇒ Object
readonly
The node that represents the declaration.
Instance Method Summary collapse
-
#initialize(node, comments) ⇒ ModuleOrClass
constructor
A new instance of ModuleOrClass.
-
#start_line ⇒ Object
: Integer.
-
#type_params ⇒ Object
Type parameters for the declaration.
Constructor Details
#initialize(node, comments) ⇒ ModuleOrClass
Returns a new instance of ModuleOrClass.
69 70 71 72 73 |
# File 'lib/rbs/inline/ast/declarations.rb', line 69 def initialize(node, comments) #: void @node = node @comments = comments @members = [] end |
Instance Attribute Details
#comments ⇒ Object (readonly)
Leading comment
62 63 64 |
# File 'lib/rbs/inline/ast/declarations.rb', line 62 def comments @comments end |
#members ⇒ Object (readonly)
Members included in the declaration
65 66 67 |
# File 'lib/rbs/inline/ast/declarations.rb', line 65 def members @members end |
#node ⇒ Object (readonly)
The node that represents the declaration
59 60 61 |
# File 'lib/rbs/inline/ast/declarations.rb', line 59 def node @node end |
Instance Method Details
#start_line ⇒ Object
: Integer
88 89 90 |
# File 'lib/rbs/inline/ast/declarations.rb', line 88 def start_line #: Integer node.location.start_line end |
#type_params ⇒ Object
Type parameters for the declaration
76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/rbs/inline/ast/declarations.rb', line 76 def type_params #: Array[RBS::AST::TypeParam] if comments = comments() comments.each_annotation.filter_map do |annotation| if annotation.is_a?(Annotations::Generic) annotation.type_param end end else [] end end |