Method: RBS::Inline::Parser#inner_annotations

Defined in:
lib/rbs/inline/parser.rb

#inner_annotations(start_line, end_line) ⇒ Object

Returns an array of annotations from comments that is located between start_line and end_line

“‘rb module Foo # line 1 (start_line)

# foo
# bar

end # line 4 (end_line) “‘



236
237
238
239
240
241
242
243
244
245
# File 'lib/rbs/inline/parser.rb', line 236

def inner_annotations(start_line, end_line) #: Array[AnnotationParser::ParsingResult]
  annotations = comments.each_value.select do |annotation|
    range = annotation.line_range
    start_line < range.begin && range.end < end_line
  end

  annotations.each do |annot|
    comments.delete(annot.line_range.end)
  end
end