Class: RBS::Inline::AST::Declarations::BlockDecl
- Defined in:
- lib/rbs/inline/ast/declarations.rb
Instance Attribute Summary collapse
-
#comments ⇒ Object
readonly
: AnnotationParser::ParsingResult?.
-
#members ⇒ Object
readonly
Members included in the declaration.
-
#node ⇒ Object
readonly
: Prism::BlockNode.
Instance Method Summary collapse
-
#initialize(node, comments) ⇒ BlockDecl
constructor
A new instance of BlockDecl.
-
#module_class_annotation ⇒ Object
: Annotations::ModuleDecl | Annotations::ClassDecl | nil.
-
#start_line ⇒ Object
: Integer.
Constructor Details
#initialize(node, comments) ⇒ BlockDecl
Returns a new instance of BlockDecl.
270 271 272 273 274 |
# File 'lib/rbs/inline/ast/declarations.rb', line 270 def initialize(node, comments) @node = node @members = [] @comments = comments end |
Instance Attribute Details
#comments ⇒ Object (readonly)
: AnnotationParser::ParsingResult?
264 265 266 |
# File 'lib/rbs/inline/ast/declarations.rb', line 264 def comments @comments end |
#members ⇒ Object (readonly)
Members included in the declaration
267 268 269 |
# File 'lib/rbs/inline/ast/declarations.rb', line 267 def members @members end |
#node ⇒ Object (readonly)
: Prism::BlockNode
262 263 264 |
# File 'lib/rbs/inline/ast/declarations.rb', line 262 def node @node end |
Instance Method Details
#module_class_annotation ⇒ Object
: Annotations::ModuleDecl | Annotations::ClassDecl | nil
280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 |
# File 'lib/rbs/inline/ast/declarations.rb', line 280 def module_class_annotation #: Annotations::ModuleDecl | Annotations::ClassDecl | nil if comments comments.each_annotation.each do |annotation| if annotation.is_a?(Annotations::ModuleDecl) return annotation end if annotation.is_a?(Annotations::ClassDecl) return annotation end end nil end end |
#start_line ⇒ Object
: Integer
276 277 278 |
# File 'lib/rbs/inline/ast/declarations.rb', line 276 def start_line #: Integer node.location.start_line end |