slice -> StringRuby 3.4 から[permalink][rdoc][edit]-
コメントの文字列そのものを返します。
例location.sliceの短縮形です。require "prism" comment = Prism.parse("# hello\n1 + 1").comments.first p comment.slice # => "# hello"
slice -> StringRuby 3.4 から[permalink][rdoc][edit]
コメントの文字列そのものを返します。location.slice の短縮形です。
require "prism"
comment = Prism.parse("# hello\n1 + 1").comments.first
p comment.slice # => "# hello"