comments -> ArrayRuby 3.3 から[permalink][rdoc][edit]-
構文解析中に見つかったコメント(Prism::Comment のサブクラスのインスタンス)の配列を返します。Prism?.parse_comments を呼び出した場合と同じ内容です。
例require "prism" comments = Prism.parse("# hello\n1 + 1").comments p comments.size # => 1 p comments.first.class # => Prism::InlineComment p comments.first.location.slice # => "# hello"[SEE_ALSO] Prism?.parse_comments