Ruby 4.0 リファレンスマニュアル

instance method Prism::Token#==

self == other -> boolRuby 3.3 から[permalink][rdoc][edit]

other が同じ typevalue を持つ Prism::Token であれば true を返します。位置(location)は比較しないため、ソースコード上の別の場所にある同じ内容のトークンどうしも等しいと判定されます。

[PARAM] other:
比較対象のオブジェクト
require "prism"

tokens = Prism.lex("1 + 1").value
p tokens[0][0] == tokens[2][0] # => true (別の位置の "1" どうし)